WC_Shipping_Zone_Data_Store::update()publicWC 3.0.0

Update zone in the database.

Method of the class: WC_Shipping_Zone_Data_Store{}

No Hooks.

Return

null. Nothing (null).

Usage

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

Changelog

Since 3.0.0 Introduced.

WC_Shipping_Zone_Data_Store::update() code WC 9.3.3

public function update( &$zone ) {
	global $wpdb;
	if ( $zone->get_id() ) {
		$wpdb->update(
			$wpdb->prefix . 'woocommerce_shipping_zones',
			array(
				'zone_name'  => $zone->get_zone_name(),
				'zone_order' => $zone->get_zone_order(),
			),
			array( 'zone_id' => $zone->get_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 );
}