Свойство | Тип | Описание | |
---|---|---|---|
$data | array | Zone Data | |
$id | integer | null | Zone ID |
Метод | Описание | |
---|---|---|
__construct ( integer | object $zone = null ) | Constructor for zones. | |
add_location ( string $code, string $type ) | Add location (state or postcode) to a zone. | |
add_shipping_method ( string $type ) : integer | Add a shipping method to this zone. | |
clear_locations ( array | string $types = ['postcode', 'state', 'country', 'continent'] ) | Clear all locations for this zone. | |
delete_shipping_method ( integer $instance_id ) : True | Delete a shipping method from a zone. | |
get_formatted_location ( integer $max = 10, string $context = 'view' ) : string | Return a text string representing what this zone is for. | |
get_shipping_methods ( $enabled_only = false ) : array | Get shipping methods linked to this zone. | |
get_zone_locations ( string $context = 'view' ) : array | Get zone locations. | |
get_zone_name ( string $context = 'view' ) : string | Get zone name. | |
get_zone_order ( string $context = 'view' ) : integer | Get zone order. | |
is_valid_location_type ( string $type ) : boolean | Is passed location type valid? | |
save ( ) : integer | Save zone data to the database. | |
set_locations ( array $locations = [] ) | Set locations. | |
set_zone_locations ( $locations ) | Set zone locations. | |
set_zone_name ( string $set ) | Set zone name. | |
set_zone_order ( integer $set ) | Set zone order. |
Метод | Описание | |
---|---|---|
generate_zone_name ( ) : string | Generate a zone name based on location. | |
get_hook_prefix ( ) : string | Prefix for action and filter hooks on data. |
Метод | Описание | |
---|---|---|
location_is_continent ( object $location ) : boolean | Location type detection. | |
location_is_country ( object $location ) : boolean | Location type detection. | |
location_is_postcode ( object $location ) : boolean | Location type detection. | |
location_is_state ( object $location ) : boolean | Location type detection. |
public __construct ( integer | object $zone = null ) | ||
$zone | integer | object | Zone ID to load from the DB or zone object. |
public add_location ( string $code, string $type ) | ||
$code | string | |
$type | string | state or postcode |
public add_shipping_method ( string $type ) : integer | ||
$type | string | shipping method type |
Результат | integer | new instance_id, 0 on failure |
public clear_locations ( array | string $types = ['postcode', 'state', 'country', 'continent'] ) | ||
$types | array | string | of location to clear |
public delete_shipping_method ( integer $instance_id ) : True | ||
$instance_id | integer | |
Результат | True | on success, false on failure |
protected generate_zone_name ( ) : string | ||
Результат | string |
protected get_hook_prefix ( ) : string | ||
Результат | string |
public get_shipping_methods ( $enabled_only = false ) : array | ||
Результат | array | of objects |
public get_zone_locations ( string $context = 'view' ) : array | ||
$context | string | |
Результат | array | of zone objects |
public get_zone_name ( string $context = 'view' ) : string | ||
$context | string | |
Результат | string |
public get_zone_order ( string $context = 'view' ) : integer | ||
$context | string | |
Результат | integer |
public is_valid_location_type ( string $type ) : boolean | ||
$type | string | |
Результат | boolean |
public set_locations ( array $locations = [] ) | ||
$locations | array | Array of locations |
public set_zone_order ( integer $set ) | ||
$set | integer |