WooCommerce Code Reference

WC_Shipping_Zones
in package

Shipping zones class.

Table of Contents

delete_zone()  : mixed
Delete a zone using it's ID
get_shipping_method()  : bool|WC_Shipping_Method
Get shipping zone using it's ID.
get_shipping_zones()  : array<string|int, WC_Shipping_Zone>
Retrieve Shipping_Zone data objects for the given zone_ids.
get_zone()  : WC_Shipping_Zone|bool
Get shipping zone using it's ID
get_zone_by()  : WC_Shipping_Zone|bool
Get shipping zone by an ID.
get_zone_matching_package()  : WC_Shipping_Zone
Find a matching zone for a given package.
get_zones()  : array<string|int, mixed>
Get shipping zones from the database.

Methods

delete_zone()

Delete a zone using it's ID

public static delete_zone(int $zone_id) : mixed
Parameters
$zone_id : int

Zone ID.

Tags
since
2.6.0
Return values
mixed

get_shipping_zones()

Retrieve Shipping_Zone data objects for the given zone_ids.

public static get_shipping_zones([array<string|int, mixed>|null $zone_ids = null ]) : array<string|int, WC_Shipping_Zone>
Parameters
$zone_ids : array<string|int, mixed>|null = null

The zone_ids of the zones to retrieve. An empty array will return no results. Use null for all zones.

Return values
array<string|int, WC_Shipping_Zone>

get_zones()

Get shipping zones from the database.

public static get_zones([string $context = 'admin' ]) : array<string|int, mixed>
Parameters
$context : string = 'admin'

Getting shipping methods for what context. Valid values, admin, json.

Tags
since
2.6.0
Return values
array<string|int, mixed>Array of arrays.