Introduced new woocommerce_reports_orders_stats_data_deleted hook
This commit is contained in:
parent
10c6016d4c
commit
272203b879
|
@ -455,18 +455,26 @@ class WC_Admin_Reports_Orders_Stats_Data_Store extends WC_Admin_Reports_Data_Sto
|
||||||
*/
|
*/
|
||||||
public static function delete_order( $post_id ) {
|
public static function delete_order( $post_id ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
$order_id = (int) $post_id;
|
||||||
$table_name = $wpdb->prefix . self::TABLE_NAME;
|
$table_name = $wpdb->prefix . self::TABLE_NAME;
|
||||||
|
|
||||||
if ( 'shop_order' !== get_post_type( $post_id ) ) {
|
if ( 'shop_order' !== get_post_type( $order_id ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$wpdb->query(
|
$wpdb->query(
|
||||||
$wpdb->prepare(
|
$wpdb->prepare(
|
||||||
"DELETE FROM ${table_name} WHERE order_id = %d",
|
"DELETE FROM ${table_name} WHERE order_id = %d",
|
||||||
$post_id
|
$order_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires when orders stats are deleted.
|
||||||
|
*
|
||||||
|
* @param int $order_id Order ID.
|
||||||
|
*/
|
||||||
|
do_action( 'woocommerce_reports_orders_stats_data_deleted', (int) $order_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue