WC_Shipping_Zone_Data_Store::delete_method()publicWC 3.0.0

Delete a method instance.

Method of the class: WC_Shipping_Zone_Data_Store{}

Return

null. Nothing (null).

Usage

$WC_Shipping_Zone_Data_Store = new WC_Shipping_Zone_Data_Store();
$WC_Shipping_Zone_Data_Store->delete_method( $instance_id );
$instance_id(int) (required)
Instance ID.

Changelog

Since 3.0.0 Introduced.

WC_Shipping_Zone_Data_Store::delete_method() code WC 9.4.2

public function delete_method( $instance_id ) {
	global $wpdb;

	$method = $this->get_method( $instance_id );

	if ( ! $method ) {
		return;
	}

	delete_option( 'woocommerce_' . $method->method_id . '_' . $instance_id . '_settings' );

	$wpdb->delete( $wpdb->prefix . 'woocommerce_shipping_zone_methods', array( 'instance_id' => $instance_id ) );

	do_action( 'woocommerce_delete_shipping_zone_method', $instance_id );
}