Property | Type | Description | |
---|---|---|---|
$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. |
Method | Description | |
---|---|---|
__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. |
Method | Description | |
---|---|---|
get_taxes_per_item ( array $costs ) : array | Calc taxes per item being shipping in costs array. |
public __construct ( integer $instance_id ) | ||
$instance_id | integer |
public calculate_shipping ( $package = [] ) |
public get_admin_options_html ( ) : string | ||
return | string |
public get_instance_form_fields ( ) : array | ||
return | array |
public get_instance_id ( ) : integer | ||
return | integer |
public get_instance_option_key ( ) : string | ||
return | string |
public get_method_description ( ) : string | ||
return | string |
public get_method_title ( ) : string | ||
return | string |
public get_rate_id ( string $suffix = '' ) : string | ||
$suffix | string | |
return | string |
public get_rates_for_package ( object $package ) : array | ||
$package | object | |
return | array |
protected get_taxes_per_item ( array $costs ) : array | ||
$costs | array | |
return | array | of taxes |
public has_settings ( ) : boolean | ||
return | boolean |
public init_instance_settings ( ) |
public is_available ( array $package ) : boolean | ||
$package | array | |
return | boolean |
public is_enabled ( ) : boolean | ||
return | boolean |
public is_taxable ( ) : boolean | ||
return | boolean |
public process_admin_options ( ) : boolean | ||
return | boolean | was anything saved? |
public string $availability | ||
return | string |
public array $countries | ||
return | array |
public string $enabled | ||
return | string |
public string $id | ||
return | string |
public array $instance_form_fields | ||
return | array |
public array $instance_settings | ||
return | array |
public string $method_description | ||
return | string |
public string $minimum_fee | ||
return | string |
public array $rates | ||
return | array |
public array $supports | ||
return | array |
public string $tax_status | ||
return | string |
public string $title | ||
return | string |