woocommerce_orders_table_datastore_extra_db_rows_for_order хук-фильтрWC 6.8.0

Allow third parties to include rows that need to be inserted/updated in custom tables when persisting an order.

Использование

add_filter( 'woocommerce_orders_table_datastore_extra_db_rows_for_order', 'wp_kama_woocommerce_orders_table_datastore_extra_db_rows_for_order_filter', 10, 3 );

/**
 * Function for `woocommerce_orders_table_datastore_extra_db_rows_for_order` filter-hook.
 * 
 * @param array     $array   Array of rows to be inserted/updated when persisting an order. Each entry should be an array with keys 'table', 'data' (the row), 'format' (row format), 'where' and 'where_format'.
 * @param \WC_Order $order   The order object.
 * @param string    $context The context of the operation: 'create' or 'update'.
 *
 * @return array
 */
function wp_kama_woocommerce_orders_table_datastore_extra_db_rows_for_order_filter( $array, $order, $context ){

	// filter...
	return $array;
}
$array(массив)
Array of rows to be inserted/updated when persisting an order. Each entry should be an array with keys 'table', 'data' (the row), 'format' (row format), 'where' and 'where_format'.
$order(\WC_Order)
The order object.
$context(строка)
The context of the operation: 'create' or 'update'.

Список изменений

С версии 6.8.0 Введена.

Где вызывается хук

OrdersTableDataStore::get_db_rows_for_order()
woocommerce_orders_table_datastore_extra_db_rows_for_order
woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php 1023
$ext_rows = apply_filters( 'woocommerce_orders_table_datastore_extra_db_rows_for_order', array(), $order, $context );

Где используется хук в WooCommerce

Использование не найдено.