woocommerce_trash_order action-hookWC 2.7.0

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

OrdersTableDataStore::delete()
woocommerce_trash_order
Abstract_WC_Order_Data_Store_CPT::delete()
woocommerce_trash_order
woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php 2263
do_action( 'woocommerce_trash_order', $order_id ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment

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' );