Hooks before and after deleting order items #4059

This commit is contained in:
Mike Jolley 2013-11-13 11:49:23 +00:00
parent b116d7619d
commit f1e6900359
1 changed files with 5 additions and 2 deletions

View File

@ -616,14 +616,17 @@ class WC_Admin_CPT_Shop_Order extends WC_Admin_CPT {
public function delete_order_items( $postid ) { public function delete_order_items( $postid ) {
global $wpdb; 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( " $wpdb->query( "
DELETE {$wpdb->prefix}woocommerce_order_items, {$wpdb->prefix}woocommerce_order_itemmeta DELETE {$wpdb->prefix}woocommerce_order_items, {$wpdb->prefix}woocommerce_order_itemmeta
FROM {$wpdb->prefix}woocommerce_order_items 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 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}'; WHERE {$wpdb->prefix}woocommerce_order_items.order_id = '{$postid}';
" ); " );
do_action( 'woocommerce_deleted_order_items', $postid );
} }
} }