PHP 클래스 WC_Shipping_Zone

Controls a single zone, loads shipping methods, and registers them for use.
파일 보기 프로젝트 열기: woocommerce/woocommerce 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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.

메소드 상세

__construct() 공개 메소드

Constructor for zones.
public __construct ( integer | object $zone = null )
$zone integer | object Zone ID to load from the DB or zone object.

add_location() 공개 메소드

Add location (state or postcode) to a zone.
public add_location ( string $code, string $type )
$code string
$type string state or postcode

add_shipping_method() 공개 메소드

Add a shipping method to this zone.
public add_shipping_method ( string $type ) : integer
$type string shipping method type
리턴 integer new instance_id, 0 on failure

clear_locations() 공개 메소드

Clear all locations for this zone.
public clear_locations ( array | string $types = ['postcode', 'state', 'country', 'continent'] )
$types array | string of location to clear

delete_shipping_method() 공개 메소드

Delete a shipping method from a zone.
public delete_shipping_method ( integer $instance_id ) : True
$instance_id integer
리턴 True on success, false on failure

generate_zone_name() 보호된 메소드

Generate a zone name based on location.
protected generate_zone_name ( ) : string
리턴 string

get_formatted_location() 공개 메소드

Return a text string representing what this zone is for.
public get_formatted_location ( integer $max = 10, string $context = 'view' ) : string
$max integer
$context string
리턴 string

get_hook_prefix() 보호된 메소드

Prefix for action and filter hooks on data.
부터: 2.7.0
protected get_hook_prefix ( ) : string
리턴 string

get_shipping_methods() 공개 메소드

Get shipping methods linked to this zone.
public get_shipping_methods ( $enabled_only = false ) : array
리턴 array of objects

get_zone_locations() 공개 메소드

Get zone locations.
public get_zone_locations ( string $context = 'view' ) : array
$context string
리턴 array of zone objects

get_zone_name() 공개 메소드

Get zone name.
public get_zone_name ( string $context = 'view' ) : string
$context string
리턴 string

get_zone_order() 공개 메소드

Get zone order.
public get_zone_order ( string $context = 'view' ) : integer
$context string
리턴 integer

is_valid_location_type() 공개 메소드

Is passed location type valid?
public is_valid_location_type ( string $type ) : boolean
$type string
리턴 boolean

save() 공개 메소드

Save zone data to the database.
public save ( ) : integer
리턴 integer

set_locations() 공개 메소드

Set locations.
public set_locations ( array $locations = [] )
$locations array Array of locations

set_zone_locations() 공개 메소드

Set zone locations.
부터: 2.7.0
public set_zone_locations ( $locations )

set_zone_name() 공개 메소드

Set zone name.
public set_zone_name ( string $set )
$set string

set_zone_order() 공개 메소드

Set zone order.
public set_zone_order ( integer $set )
$set integer

프로퍼티 상세

$data 보호되어 있는 프로퍼티

Zone Data
protected array $data
리턴 array

$id 보호되어 있는 프로퍼티

Zone ID
protected int|null $id
리턴 integer | null