From 8f7a9ced04cdfa004a085f902d7c510eb3fe114f Mon Sep 17 00:00:00 2001 From: Barry Hughes <3594411+barryhughes@users.noreply.github.com> Date: Tue, 28 May 2024 12:14:22 -0700 Subject: [PATCH] Add action `woocommerce_rest_delete_shipping_zone_method` (#47862) Add action `woocommerce_rest_delete_shipping_zone_method` and remove inappropriate product review action. --- .../changelog/fix-43346-rest-delete-zone-action | 4 ++++ ...-wc-rest-shipping-zone-methods-v2-controller.php | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 plugins/woocommerce/changelog/fix-43346-rest-delete-zone-action diff --git a/plugins/woocommerce/changelog/fix-43346-rest-delete-zone-action b/plugins/woocommerce/changelog/fix-43346-rest-delete-zone-action new file mode 100644 index 00000000000..4828d8cbfa8 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-43346-rest-delete-zone-action @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Adds new hook `woocommerce_rest_delete_shipping_zone_method` which will fire after a shipping zone method is deleted via the REST API. diff --git a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php index e153ba4102c..0800ec9b278 100644 --- a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php +++ b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php @@ -231,13 +231,16 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones } /** - * Fires after a product review is deleted via the REST API. + * Fires after a shipping zone is deleted via the REST API. * - * @param object $method - * @param WP_REST_Response $response The response data. - * @param WP_REST_Request $request The request sent to the API. + * @since 9.1.0 + * + * @param WC_Shipping_Method $method The shipping zone method being deleted. + * @param WC_Shipping_Zone $zone The shipping zone the method belonged to. + * @param WP_REST_Response $response The response data. + * @param WP_REST_Request $request The request sent to the API. */ - do_action( 'rest_delete_product_review', $method, $response, $request ); + do_action( 'woocommerce_rest_delete_shipping_zone_method', $method, $zone, $response, $request ); return $response; }