WordPress at Your Fingertips
function is not described

WC_Shipping_Zone_Data_Store::create() public WC 3.0.0

Method to create a new shipping zone.

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

No Hooks.

Return

null. Nothing.

Usage

$WC_Shipping_Zone_Data_Store = new WC_Shipping_Zone_Data_Store();
$WC_Shipping_Zone_Data_Store->create( $zone );
$zone(WC_Shipping_Zone) (required) (passed by reference — &)
Shipping zone object.

Changelog

Since 3.0.0 Introduced.

Code of WC_Shipping_Zone_Data_Store::create() WC 5.8.0

public function create( &$zone ) {
	global $wpdb;
	$wpdb->insert(
		$wpdb->prefix . 'woocommerce_shipping_zones',
		array(
			'zone_name'  => $zone->get_zone_name(),
			'zone_order' => $zone->get_zone_order(),
		)
	);
	$zone->set_id( $wpdb->insert_id );
	$zone->save_meta_data();
	$this->save_locations( $zone );
	$zone->apply_changes();
	WC_Cache_Helper::invalidate_cache_group( 'shipping_zones' );
	WC_Cache_Helper::get_transient_version( 'shipping', true );
}