You appear to be a bot. Output may be restricted
Description
Get shipping zones from the database.
Usage
$array = WC_Shipping_Zones::get_zones( $context );
Parameters
- $context
- ( string ) optional default: admin – Getting shipping methods for what context. Valid values, admin, json.
Returns
array Array of arrays.
Source
File name: woocommerce/includes/class-wc-shipping-zones.php
Lines:
1 to 15 of 15
public static function get_zones( $context = 'admin' ) { $data_store = WC_Data_Store::load( 'shipping-zone' ); $raw_zones = $data_store->get_zones(); $zones = array(); foreach ( $raw_zones as $raw_zone ) { $zone = new WC_Shipping_Zone( $raw_zone ); $zones[ $zone->get_id() ] = $zone->get_data(); $zones[ $zone->get_id() ]['zone_id'] = $zone->get_id(); $zones[ $zone->get_id() ]['formatted_zone_location'] = $zone->get_formatted_location(); $zones[ $zone->get_id() ]['shipping_methods'] = $zone->get_shipping_methods( false, $context ); } return $zones; }