WC_Shipping_Zone_Data_Store::add_method()
Add a shipping method to a zone.
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. |
WC_Shipping_Zone_Data_Store::add_method() WC Shipping Zone Data Store::add method code WC 9.4.2
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; }