woocommerce_before_trash_order
Fires immediately before an order is trashed.
Usage
add_action( 'woocommerce_before_trash_order', 'wp_kama_woocommerce_before_trash_order_action', 10, 2 );
/**
* Function for `woocommerce_before_trash_order` action-hook.
*
* @param int $order_id ID of the order about to be trashed.
* @param WC_Order $order Instance of the order that is about to be trashed.
*
* @return void
*/
function wp_kama_woocommerce_before_trash_order_action( $order_id, $order ){
// action...
}
- $order_id(int)
- ID of the order about to be trashed.
- $order(WC_Order)
- Instance of the order that is about to be trashed.
Changelog
| Since 7.1.0 | Introduced. |
Where the hook is called
woocommerce_before_trash_order
woocommerce_before_trash_order
woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php 2464
do_action( 'woocommerce_before_trash_order', $order_id, $order );
woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php 322
do_action( 'woocommerce_before_trash_order', $id, $order );
Where the hook is used in WooCommerce
woocommerce/src/Caches/OrderCountCacheService.php 50
add_action( 'woocommerce_before_trash_order', array( $this, 'update_on_order_trashed' ), 10, 2 );