woocommerce_orders_table_datastore_db_rows_for_order filter-hookWC 8.8.0

Filters the rows that are going to be inserted or updated during an order save.

Usage

add_filter( 'woocommerce_orders_table_datastore_db_rows_for_order', 'wp_kama_woocommerce_orders_table_datastore_db_rows_for_order_filter', 10, 3 );

/**
 * Function for `woocommerce_orders_table_datastore_db_rows_for_order` filter-hook.
 * 
 * @param array     $rows    Array of rows to be inserted/updated. See 'woocommerce_orders_table_datastore_extra_db_rows_for_order' for exact 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_db_rows_for_order_filter( $rows, $order, $context ){

	// filter...
	return $rows;
}
$rows(array)
Array of rows to be inserted/updated. See 'woocommerce_orders_table_datastore_extra_db_rows_for_order' for exact format.
$order(\WC_Order)
The order object.
$context(string)
The context of the operation: 'create' or 'update'.

Changelog

Since 8.8.0 Introduced.

Where the hook is called

OrdersTableDataStore::get_db_rows_for_order()
woocommerce_orders_table_datastore_db_rows_for_order
woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php 2114-2119
$result = apply_filters(
	'woocommerce_orders_table_datastore_db_rows_for_order',
	array_merge( $result, $ext_rows ),
	$order,
	$context
);

Where the hook is used in WooCommerce

woocommerce/src/Internal/DataStores/Orders/LegacyDataHandler.php 418
add_filter( 'woocommerce_orders_table_datastore_db_rows_for_order', $limit_cb, 10, 2 );
woocommerce/src/Internal/DataStores/Orders/LegacyDataHandler.php 425
remove_filter( 'woocommerce_orders_table_datastore_db_rows_for_order', $limit_cb );