WC_Shipping_Zone_Data_Store::add_method( int $zone_id, string $type, int $order )

Add a shipping method to a zone.


Description Description


Parameters Parameters

$zone_id

(Required) Zone ID.

$type

(Required) Method Type/ID.

$order

(Required) Method Order.


Top ↑

Return Return

(int) Instance ID


Top ↑

Source Source

File: includes/data-stores/class-wc-shipping-zone-data-store.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.