woocommerce_shipping_zone_method_status_toggled

woocommerce_shipping_zone_method_status_toggled

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

do_action('woocommerce_shipping_zone_method_status_toggled') is found 2 times:

  • /includes/class-wc-ajax.php line 3380
    3376
    3377
    3378
    3379
    3380
    3381
    3382
    3383
    3384
    3385
    3386
                 */
                do_action( 'woocommerce_update_non_option_setting', array( 'id' => 'zone_methods_enabled' ) );
                $is_enabled = absint( 'yes' === $method_data['enabled'] );
                if ( $wpdb->update( "{$wpdb->prefix}woocommerce_shipping_zone_methods", array( 'is_enabled' => $is_enabled ), array( 'instance_id' => absint( $instance_id ) ) ) ) {
                    do_action( 'woocommerce_shipping_zone_method_status_toggled', $instance_id, $method_id, $zone_id, $is_enabled );
                }
            }
        }
    }
     
    $zone->save();
  • /includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php line 336
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
        // Update if this method is enabled or not.
        if ( isset( $request['enabled'] ) ) {
            if ( $wpdb->update( "{$wpdb->prefix}woocommerce_shipping_zone_methods", array( 'is_enabled' => $request['enabled'] ), array( 'instance_id' => absint( $instance_id ) ) ) ) {
                do_action( 'woocommerce_shipping_zone_method_status_toggled', $instance_id, $method->id, $request['zone_id'], $request['enabled'] );
                $method->enabled = ( true === $request['enabled'] ? 'yes' : 'no' );
            }
        }
     
        return $method;
    }