woocommerce_trash_order
Fires immediately after an order is trashed.
Usage
add_action( 'woocommerce_trash_order', 'wp_kama_woocommerce_trash_order_action' ); /** * Function for `woocommerce_trash_order` action-hook. * * @param int $order_id ID of the order that has been trashed. * * @return void */ function wp_kama_woocommerce_trash_order_action( $order_id ){ // action... }
- $order_id(int)
- ID of the order that has been trashed.
Changelog
Since 2.7.0 | Introduced. |
Where the hook is called
woocommerce_trash_order
woocommerce_trash_order
woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php 2263
do_action( 'woocommerce_trash_order', $order_id ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php 332
do_action( 'woocommerce_trash_order', $id );
Where the hook is used in WooCommerce
woocommerce/includes/wc-order-functions.php 1021
add_action( 'woocommerce_trash_order', 'wc_update_coupon_usage_counts' );
woocommerce/includes/wc-order-functions.php 945
add_action( 'woocommerce_trash_order', 'wc_update_total_sales_counts' );