PHP 클래스 WC_Shipping_Method

Extended by shipping methods to handle shipping calculations etc.
저자: WooThemes
상속: extends WC_Settings_API
파일 보기 프로젝트 열기: woocommerce/woocommerce 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$availability string No longer useful for instance based shipping methods.
$countries array No longer useful for instance based shipping methods.
$enabled string yes or no based on whether the method is enabled.
$fee string Fee for the method (if applicable).
$id string Unique ID for the shipping method - must be set.
$instance_form_fields array Instance form fields.
$instance_id integer Instance ID if used.
$instance_settings array Instance settings.
$method_description string Method description.
$method_title string Method title.
$minimum_fee string Minimum fee for the method (if applicable).
$rates array This is an array of rates - methods must populate this array to register shipping costs.
$supports array - settings Non-instance settings screens. Enabled by default for BW compatibility with methods before instances existed. - instance-settings-modal Allows the instance settings to be loaded within a modal in the zones UI.
$tax_status string If 'taxable' tax will be charged for this method (if applicable).
$title string Shipping method title for the frontend.

공개 메소드들

메소드 설명
__construct ( integer $instance_id ) Constructor.
add_rate ( array $args = [] ) Add a shipping rate. If taxes are not set they will be calculated based on cost.
admin_options ( ) Output the shipping settings screen.
calculate_shipping ( $package = [] ) Called to calculate shipping rates for this method. Rates can be added using the add_rate() method.
get_admin_options_html ( ) : string Return admin options as a html string.
get_fee ( string | float $fee, float $total ) : float Get fee to add to shipping cost.
get_instance_form_fields ( ) : array Get settings fields for instances of this shipping method (within zones).
get_instance_id ( ) : integer Return the shipping method instance ID.
get_instance_option ( string $key, mixed $empty_value = null ) : mixed Gets an option from the settings API, using defaults if necessary to prevent undefined notices.
get_instance_option_key ( ) : string Return the name of the option in the WP DB.
get_method_description ( ) : string Return the shipping method description.
get_method_title ( ) : string Return the shipping method title.
get_option ( string $key, mixed $empty_value = null ) : mixed get_option function.
get_rate_id ( string $suffix = '' ) : string Returns a rate ID based on this methods ID and instance, with an optional suffix if distinguishing between multiple rates.
get_rates_for_package ( object $package ) : array Return calculated rates for a package.
get_title ( ) : string Return the shipping title which is user set.
has_settings ( ) : boolean Does this method have a settings page?
init_instance_settings ( ) Initialise Settings for instances.
is_available ( array $package ) : boolean Is this method available?
is_enabled ( ) : boolean Whether or not this method is enabled in settings.
is_taxable ( ) : boolean Whether or not we need to calculate tax on top of the shipping rate.
process_admin_options ( ) : boolean Processes and saves options.
supports ( $feature ) : boolean Check if a shipping method supports a given feature.

보호된 메소드들

메소드 설명
get_taxes_per_item ( array $costs ) : array Calc taxes per item being shipping in costs array.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( integer $instance_id )
$instance_id integer

add_rate() 공개 메소드

Add a shipping rate. If taxes are not set they will be calculated based on cost.
public add_rate ( array $args = [] )
$args array (default: array())

admin_options() 공개 메소드

Output the shipping settings screen.
public admin_options ( )

calculate_shipping() 공개 메소드

Called to calculate shipping rates for this method. Rates can be added using the add_rate() method.
public calculate_shipping ( $package = [] )

get_admin_options_html() 공개 메소드

Return admin options as a html string.
public get_admin_options_html ( ) : string
리턴 string

get_fee() 공개 메소드

Get fee to add to shipping cost.
public get_fee ( string | float $fee, float $total ) : float
$fee string | float
$total float
리턴 float

get_instance_form_fields() 공개 메소드

Should be overridden by shipping methods to add options.
부터: 2.6.0
public get_instance_form_fields ( ) : array
리턴 array

get_instance_id() 공개 메소드

Return the shipping method instance ID.
부터: 2.6.0
public get_instance_id ( ) : integer
리턴 integer

get_instance_option() 공개 메소드

Gets an option from the settings API, using defaults if necessary to prevent undefined notices.
public get_instance_option ( string $key, mixed $empty_value = null ) : mixed
$key string
$empty_value mixed
리턴 mixed The value specified for the option or a default value for the option.

get_instance_option_key() 공개 메소드

Return the name of the option in the WP DB.
부터: 2.6.0
public get_instance_option_key ( ) : string
리턴 string

get_method_description() 공개 메소드

Return the shipping method description.
부터: 2.6.0
public get_method_description ( ) : string
리턴 string

get_method_title() 공개 메소드

Return the shipping method title.
부터: 2.6.0
public get_method_title ( ) : string
리턴 string

get_option() 공개 메소드

Gets and option from the settings API, using defaults if necessary to prevent undefined notices.
public get_option ( string $key, mixed $empty_value = null ) : mixed
$key string
$empty_value mixed
리턴 mixed The value specified for the option or a default value for the option.

get_rate_id() 공개 메소드

Returns a rate ID based on this methods ID and instance, with an optional suffix if distinguishing between multiple rates.
부터: 2.6.0
public get_rate_id ( string $suffix = '' ) : string
$suffix string
리턴 string

get_rates_for_package() 공개 메소드

Return calculated rates for a package.
부터: 2.6.0
public get_rates_for_package ( object $package ) : array
$package object
리턴 array

get_taxes_per_item() 보호된 메소드

Calc taxes per item being shipping in costs array.
부터: 2.6.0
protected get_taxes_per_item ( array $costs ) : array
$costs array
리턴 array of taxes

get_title() 공개 메소드

Return the shipping title which is user set.
public get_title ( ) : string
리턴 string

has_settings() 공개 메소드

Does this method have a settings page?
public has_settings ( ) : boolean
리턴 boolean

init_instance_settings() 공개 메소드

Initialise Settings for instances.
부터: 2.6.0

is_available() 공개 메소드

Is this method available?
public is_available ( array $package ) : boolean
$package array
리턴 boolean

is_enabled() 공개 메소드

Whether or not this method is enabled in settings.
부터: 2.6.0
public is_enabled ( ) : boolean
리턴 boolean

is_taxable() 공개 메소드

Whether or not we need to calculate tax on top of the shipping rate.
public is_taxable ( ) : boolean
리턴 boolean

process_admin_options() 공개 메소드

If there is an error thrown, will continue to save and validate fields, but will leave the erroring field out.
부터: 2.6.0
public process_admin_options ( ) : boolean
리턴 boolean was anything saved?

supports() 공개 메소드

Methods should override this to declare support (or lack of support) for a feature.
public supports ( $feature ) : boolean
$feature string The name of a feature to test support for.
리턴 boolean True if the shipping method supports the feature, false otherwise.

프로퍼티 상세

$availability 공개적으로 프로퍼티

No longer useful for instance based shipping methods.
사용 중단: 2.6.0
public string $availability
리턴 string

$countries 공개적으로 프로퍼티

No longer useful for instance based shipping methods.
사용 중단: 2.6.0
public array $countries
리턴 array

$enabled 공개적으로 프로퍼티

yes or no based on whether the method is enabled.
public string $enabled
리턴 string

$fee 공개적으로 프로퍼티

Fee for the method (if applicable).
public string $fee
리턴 string

$id 공개적으로 프로퍼티

Unique ID for the shipping method - must be set.
public string $id
리턴 string

$instance_form_fields 공개적으로 프로퍼티

Instance form fields.
public array $instance_form_fields
리턴 array

$instance_id 공개적으로 프로퍼티

Instance ID if used.
public int $instance_id
리턴 integer

$instance_settings 공개적으로 프로퍼티

Instance settings.
public array $instance_settings
리턴 array

$method_description 공개적으로 프로퍼티

Method description.
public string $method_description
리턴 string

$method_title 공개적으로 프로퍼티

Method title.
public string $method_title
리턴 string

$minimum_fee 공개적으로 프로퍼티

Minimum fee for the method (if applicable).
public string $minimum_fee
리턴 string

$rates 공개적으로 프로퍼티

This is an array of rates - methods must populate this array to register shipping costs.
public array $rates
리턴 array

$supports 공개적으로 프로퍼티

- settings Non-instance settings screens. Enabled by default for BW compatibility with methods before instances existed. - instance-settings-modal Allows the instance settings to be loaded within a modal in the zones UI.
public array $supports
리턴 array

$tax_status 공개적으로 프로퍼티

If 'taxable' tax will be charged for this method (if applicable).
public string $tax_status
리턴 string

$title 공개적으로 프로퍼티

Shipping method title for the frontend.
public string $title
리턴 string