Hooks before and after deleting order items #4059
This commit is contained in:
parent
b116d7619d
commit
f1e6900359
|
@ -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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue