From 8de220beeb166631bb105ee508cbb00798cb1251 Mon Sep 17 00:00:00 2001 From: Amit Sidhpura Date: Sat, 7 Jan 2017 11:10:36 +0530 Subject: [PATCH 1/2] Actions on delete of zone and zone method Hooks on delete of zone and zone method. I have named it 'woocommerce_delete_zone' and 'woocommerce_delete_zone_mehod' making it same format as customer delete action 'woocommerce_delete_customer'. --- includes/data-stores/class-wc-shipping-zone-data-store.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/data-stores/class-wc-shipping-zone-data-store.php b/includes/data-stores/class-wc-shipping-zone-data-store.php index cb5372d7fd3..1fd382c14db 100644 --- a/includes/data-stores/class-wc-shipping-zone-data-store.php +++ b/includes/data-stores/class-wc-shipping-zone-data-store.php @@ -94,7 +94,9 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin $wpdb->delete( $wpdb->prefix . 'woocommerce_shipping_zone_locations', array( 'zone_id' => $zone->get_id() ) ); $wpdb->delete( $wpdb->prefix . 'woocommerce_shipping_zones', array( 'zone_id' => $zone->get_id() ) ); WC_Cache_Helper::incr_cache_prefix( 'shipping_zones' ); + $id = $zone->get_id(); $zone->set_id( null ); + do_action( 'woocommerce_delete_zone', $id ); } } @@ -160,6 +162,7 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin public function delete_method( $instance_id ) { global $wpdb; $wpdb->delete( $wpdb->prefix . 'woocommerce_shipping_zone_methods', array( 'instance_id' => $instance_id ) ); + do_action( 'woocommerce_delete_zone_method', $instance_id ); } /** From 887aa5fe1bc84c9d260f495a5b3b4d4121d031f9 Mon Sep 17 00:00:00 2001 From: Amit Sidhpura Date: Sat, 7 Jan 2017 11:16:31 +0530 Subject: [PATCH 2/2] sorry change zone in action to shipping_zone --- includes/data-stores/class-wc-shipping-zone-data-store.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/data-stores/class-wc-shipping-zone-data-store.php b/includes/data-stores/class-wc-shipping-zone-data-store.php index 1fd382c14db..f954d94d3fc 100644 --- a/includes/data-stores/class-wc-shipping-zone-data-store.php +++ b/includes/data-stores/class-wc-shipping-zone-data-store.php @@ -96,7 +96,7 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin WC_Cache_Helper::incr_cache_prefix( 'shipping_zones' ); $id = $zone->get_id(); $zone->set_id( null ); - do_action( 'woocommerce_delete_zone', $id ); + do_action( 'woocommerce_delete_shipping_zone', $id ); } } @@ -162,7 +162,7 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin public function delete_method( $instance_id ) { global $wpdb; $wpdb->delete( $wpdb->prefix . 'woocommerce_shipping_zone_methods', array( 'instance_id' => $instance_id ) ); - do_action( 'woocommerce_delete_zone_method', $instance_id ); + do_action( 'woocommerce_delete_shipping_zone_method', $instance_id ); } /**