Property | Type | Description | |
---|---|---|---|
$data | array | Zone Data | |
$id | integer | null | Zone ID |
Method | Description | |
---|---|---|
__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. |
Method | Description | |
---|---|---|
generate_zone_name ( ) : string | Generate a zone name based on location. | |
get_hook_prefix ( ) : string | Prefix for action and filter hooks on data. |
Method | Description | |
---|---|---|
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 |
return | 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 | |
return | True | on success, false on failure |
protected generate_zone_name ( ) : string | ||
return | string |
protected get_hook_prefix ( ) : string | ||
return | string |
public get_shipping_methods ( $enabled_only = false ) : array | ||
return | array | of objects |
public get_zone_locations ( string $context = 'view' ) : array | ||
$context | string | |
return | array | of zone objects |
public get_zone_name ( string $context = 'view' ) : string | ||
$context | string | |
return | string |
public get_zone_order ( string $context = 'view' ) : integer | ||
$context | string | |
return | integer |
public is_valid_location_type ( string $type ) : boolean | ||
$type | string | |
return | boolean |
public set_locations ( array $locations = [] ) | ||
$locations | array | Array of locations |