From f1e6900359422abe453dee41b9b82275d9ecfb49 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 13 Nov 2013 11:49:23 +0000 Subject: [PATCH] Hooks before and after deleting order items #4059 --- .../admin/post-types/class-wc-admin-cpt-shop_order.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/admin/post-types/class-wc-admin-cpt-shop_order.php b/includes/admin/post-types/class-wc-admin-cpt-shop_order.php index 3f03264bba4..53e550c780d 100644 --- a/includes/admin/post-types/class-wc-admin-cpt-shop_order.php +++ b/includes/admin/post-types/class-wc-admin-cpt-shop_order.php @@ -616,14 +616,17 @@ class WC_Admin_CPT_Shop_Order extends WC_Admin_CPT { public function delete_order_items( $postid ) { global $wpdb; - if ( get_post_type( $postid ) == 'shop_order' ) - { + if ( get_post_type( $postid ) == 'shop_order' ) { + do_action( 'woocommerce_delete_order_items', $postid ); + $wpdb->query( " DELETE {$wpdb->prefix}woocommerce_order_items, {$wpdb->prefix}woocommerce_order_itemmeta FROM {$wpdb->prefix}woocommerce_order_items JOIN {$wpdb->prefix}woocommerce_order_itemmeta ON {$wpdb->prefix}woocommerce_order_items.order_item_id = {$wpdb->prefix}woocommerce_order_itemmeta.order_item_id WHERE {$wpdb->prefix}woocommerce_order_items.order_id = '{$postid}'; " ); + + do_action( 'woocommerce_deleted_order_items', $postid ); } }