Merge pull request #12720 from franticpsyx/delete-vs-trash-object-hooks

[2.7] Separate trash and delete CRUD object hooks
This commit is contained in:
Mike Jolley 2017-01-03 11:00:34 +00:00 committed by GitHub
commit 3e10368ad6
3 changed files with 6 additions and 3 deletions

View File

@ -134,11 +134,12 @@ abstract class Abstract_WC_Order_Data_Store_CPT extends WC_Data_Store_WP impleme
if ( $args['force_delete'] ) {
wp_delete_post( $id );
$order->set_id( 0 );
do_action( 'woocommerce_delete_order', $id );
} else {
wp_trash_post( $id );
$order->set_status( 'trash' );
do_action( 'woocommerce_trash_order', $id );
}
do_action( 'woocommerce_delete_order', $id );
}
/*

View File

@ -155,10 +155,11 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
if ( $args['force_delete'] ) {
wp_delete_post( $coupon->get_id() );
$coupon->set_id( 0 );
do_action( 'woocommerce_delete_coupon', $id );
} else {
wp_trash_post( $coupon->get_id() );
do_action( 'woocommerce_trash_coupon', $id );
}
do_action( 'woocommerce_delete_coupon', $id );
}
/**

View File

@ -186,11 +186,12 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
if ( $args['force_delete'] ) {
wp_delete_post( $product->get_id() );
$product->set_id( 0 );
do_action( 'woocommerce_delete_' . $post_type, $id );
} else {
wp_trash_post( $product->get_id() );
$product->set_status( 'trash' );
do_action( 'woocommerce_trash_' . $post_type, $id );
}
do_action( 'woocommerce_delete_' . $post_type, $id );
}
/*