woocommerce_orders_table_datastore_extra_db_rows_for_order
Allow third parties to include rows that need to be inserted/updated in custom tables when persisting an order.
Usage
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)
- 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(string)
- The context of the operation: 'create' or 'update'.
Changelog
| Since 6.8.0 | Introduced. |
Where the hook is called
woocommerce_orders_table_datastore_extra_db_rows_for_order
woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php 2532
$ext_rows = apply_filters( 'woocommerce_orders_table_datastore_extra_db_rows_for_order', array(), $order, $context );