woocommerce_before_delete_order
Fires immediately before an order is deleted from the database.
Usage
add_action( 'woocommerce_before_delete_order', 'wp_kama_woocommerce_before_delete_order_action', 10, 2 );
/**
* Function for `woocommerce_before_delete_order` action-hook.
*
* @param int $order_id ID of the order about to be deleted.
* @param WC_Order $order Instance of the order that is about to be deleted.
*
* @return void
*/
function wp_kama_woocommerce_before_delete_order_action( $order_id, $order ){
// action...
}
- $order_id(int)
- ID of the order about to be deleted.
- $order(WC_Order)
- Instance of the order that is about to be deleted.
Changelog
| Since 7.1.0 | Introduced. |
Where the hook is called
woocommerce_before_delete_order
woocommerce_before_delete_order
woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php 2416
do_action( 'woocommerce_before_delete_order', $order_id, $order );
woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php 296
do_action( 'woocommerce_before_delete_order', $id, $order );
Where the hook is used in WooCommerce
woocommerce/includes/class-wc-post-data.php 66
add_action( 'woocommerce_before_delete_order', array( __CLASS__, 'before_delete_order' ) );
woocommerce/includes/wc-order-functions.php 1000
add_action( 'woocommerce_before_delete_order', 'wc_update_total_sales_counts' );
woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php 143
add_action( 'woocommerce_before_delete_order', array( __CLASS__, 'delete_order' ) );
woocommerce/src/Admin/Features/Fulfillments/FulfillmentsManager.php 104
add_action( 'woocommerce_before_delete_order', array( $this, 'delete_order_fulfillments' ), 10, 1 );
woocommerce/src/Caches/OrderCountCacheService.php 51
add_action( 'woocommerce_before_delete_order', array( $this, 'update_on_order_deleted' ), 10, 2 );
woocommerce/src/Internal/Caches/OrdersVersionStringInvalidator.php 66
add_action( 'woocommerce_before_delete_order', array( $this, 'handle_woocommerce_before_delete_order' ), 10, 2 );