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_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
Return values
mixed —get_shipping_method()
Get shipping zone using it's ID.
public
static get_shipping_method(int $instance_id) : bool|WC_Shipping_Method
Parameters
- $instance_id : int
-
Instance ID.
Tags
Return values
bool|WC_Shipping_Method —get_zone()
Get shipping zone using it's ID
public
static get_zone(int $zone_id) : WC_Shipping_Zone|bool
Parameters
- $zone_id : int
-
Zone ID.
Tags
Return values
WC_Shipping_Zone|bool —get_zone_by()
Get shipping zone by an ID.
public
static get_zone_by([string $by = 'zone_id' ], int $id) : WC_Shipping_Zone|bool
Parameters
- $by : string = 'zone_id'
-
Get by 'zone_id' or 'instance_id'.
- $id : int
-
ID.
Tags
Return values
WC_Shipping_Zone|bool —get_zone_matching_package()
Find a matching zone for a given package.
public
static get_zone_matching_package(array<string|int, mixed> $package) : WC_Shipping_Zone
Parameters
- $package : array<string|int, mixed>
-
Shipping package.
Tags
Return values
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.