WordPress at Your Fingertips
function is not described

WC_Shipping_Zone_Data_Store::add_method() public WC 3.0.0

Add a shipping method to a zone.

{} It's a method of the class: WC_Shipping_Zone_Data_Store{}

No Hooks.

Return

Int. Instance ID

Usage

$WC_Shipping_Zone_Data_Store = new WC_Shipping_Zone_Data_Store();
$WC_Shipping_Zone_Data_Store->add_method( $zone_id, $type, $order );
$zone_id(int) (required)
Zone ID.
$type(string) (required)
Method Type/ID.
$order(int) (required)
Method Order.

Changelog

Since 3.0.0 Introduced.

Code of WC_Shipping_Zone_Data_Store::add_method() WC 5.6.0

public function add_method( $zone_id, $type, $order ) {
	global $wpdb;
	$wpdb->insert(
		$wpdb->prefix . 'woocommerce_shipping_zone_methods',
		array(
			'method_id'    => $type,
			'zone_id'      => $zone_id,
			'method_order' => $order,
		),
		array(
			'%s',
			'%d',
			'%d',
		)
	);
	return $wpdb->insert_id;
}