WC_Shipping_Zone_Data_Store::read_zone_locations()privateWC 1.0

Read location data from the database.

Method of the class: WC_Shipping_Zone_Data_Store{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->read_zone_locations( $zone );
$zone(WC_Shipping_Zone) (required) (passed by reference — &)
Shipping zone object.

WC_Shipping_Zone_Data_Store::read_zone_locations() code WC 8.7.0

private function read_zone_locations( &$zone ) {
	global $wpdb;

	$locations = $wpdb->get_results(
		$wpdb->prepare(
			"SELECT location_code, location_type FROM {$wpdb->prefix}woocommerce_shipping_zone_locations WHERE zone_id = %d",
			$zone->get_id()
		)
	);

	if ( $locations ) {
		foreach ( $locations as $location ) {
			$zone->add_location( $location->location_code, $location->location_type );
		}
	}
}