WC_Shipping_Zone::delete_shipping_method()publicWC 1.0

Delete a shipping method from a zone.

Method of the class: WC_Shipping_Zone{}

Return

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() code WC 9.4.2

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;
}