WC_Shipping_Zone::delete_shipping_method
Delete a shipping method from a zone.
Method of the class: WC_Shipping_Zone{}
Hooks from the method
Returns
True. on success, false on failure
Usage
$WC_Shipping_Zone = new WC_Shipping_Zone(); $WC_Shipping_Zone->delete_shipping_method( $instance_id );
- $instance_id(int) (required)
- Shipping method instance ID.
WC_Shipping_Zone::delete_shipping_method() WC Shipping Zone::delete shipping method code WC 10.3.6
public function delete_shipping_method( $instance_id ) {
if ( null === $this->get_id() ) {
return false;
}
// Get method details.
$method = $this->data_store->get_method( $instance_id );
if ( $method ) {
$this->data_store->delete_method( $instance_id );
do_action( 'woocommerce_shipping_zone_method_deleted', $instance_id, $method->method_id, $this->get_id() );
}
WC_Cache_Helper::get_transient_version( 'shipping', true );
return true;
}