WordPress action hook
woocommerce_shipping_zone_method_status_toggled
Defined by WooCommerce and fired by 17 plugins in total, running on 7.1M+ sites between them.
“Fires when a shipping method's enabled status is toggled.”
How to use woocommerce_shipping_zone_method_status_toggled
It's an action: your callback runs at that point and receives 4 arguments. Nothing needs to be returned.
Add this to your theme's functions.php or a small custom plugin:
add_action( 'woocommerce_shipping_zone_method_status_toggled', function( $absint, $arg2, $zone_id, $arg4 ) {
// Your code runs here.
}, 10, 4 );Argument names come from Postex Advanced Shipping Method's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
17 plugins that fire woocommerce_shipping_zone_method_status_toggled
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WooCommerce7+ million installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $instance_id, $method->id, $zone_id, (bool) $updates['is_enabled'] )src/Internal/RestApi/Routes/V4/ShippingZoneMethod/ShippingZoneMethodService.php:167 -
Weight Based Shipping Table Rate for WooCommerce100,000+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $shipping_method->instance_id, $shipping_method->id, $zone->get_id(), $status )src/WPDesk/FS/TableRate/ShippingMethod/Management/ShippingMethodManagement.php:43 -
Packlink PRO for WooCommerce20,000+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $item->instance_id, $item->id, $zone_id, 0 )Components/ShippingMethod/class-shipping-method-helper.php:211 -
Agent Abilities for MCP1,000+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $instance_id, (string) $method->id, $zone_id, (bool) $is_enabled )includes/abilities/woocommerce/shipping.php:1039 -
KiriminAja Official200+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $instance_id, self::METHOD_ID, $zone_id, 1 )inc/Services/WooCommerceShippingMethodRegistrationService.php:140 -
Postex Advanced Shipping Method200+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', absint($postex_method->instance_id), 'postex', $zone_id, 1 )core/woocommerce.php:343 -
[Niewspierana wersja100+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $method->get_instance_id(), $method->id, $epaka_zone->get_id(), false )includes/class-epaka-activator.php:59 -
BulCommerce60+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $instance, $method_id, $zone_id, $on ? 1 : 0 )src/Shipping/Admin/CourierSettingsPage.php:484 -
Yaxii Shipping Manager40+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $instance_id, 'flat_rate', $zone_id, $enabled ? 1 : 0 )src/Apply/SafeApplyEngine.php:621 -
پستکس ویژه خانه کتاب30+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', absint($postex_method->instance_id), 'postex', $zone_id, 1 )core/woocommerce.php:358 -
ByteCoreStack20+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', (int) $instance_id, $method->id, $zone->get_id(), $enabled )includes/MCP/Server.php:7816 -
ShipBG for WooCommerce20+ installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $method->instance_id, $method->id, $zone->get_id(), true )src/Admin/ShippingZoneSetup.php:404 -
SarcioFewer than 10 installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $instanceId, (string) $found['method']->id, (int) $found['zone']->id, $enabled )src/Assistant/WooStoreAbilities.php:568 -
Dox POS for WooCommerceFewer than 10 installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $instance_id, $method->id, (int) $zone->get_id(), $on )includes/shipping-setup.php:637 -
Wuunder ShippingFewer than 10 installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $instance_id, $shipping_method->id, $zone_id, 0 )src/Services/CarrierService.php:211 -
Shipping Contract Guard for WooCommerceFewer than 10 installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $instanceId, (string) $method->id, $zoneId, $enabled ? 1 : 0 )src/WooCommerce/PublicCoreMethodControl.php:114 -
Invoice management for WoocommerceFewer than 10 installs
do_action( 'woocommerce_shipping_zone_method_status_toggled', $instance_id, $method_id, $zone_id, $is_enabled )includes/class-wc-ajax.php:3049
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.