WC_Shipping_Rate
in package
Shipping rate class.
Table of Contents
- $data : array
- Stores data for this rate.
- $meta_data : array
- Stores meta data for this rate.
- __construct() : mixed
- Constructor.
- __get() : mixed
- Magic methods to support direct access to props.
- __isset() : bool
- Magic methods to support direct access to props.
- __set() : mixed
- Magic methods to support direct access to props.
- add_meta_data() : mixed
- Add some meta data for this rate.
- get_cost() : string
- Set rate cost.
- get_id() : string
- Set ID for the rate. This is usually a combination of the method and instance IDs.
- get_instance_id() : int
- Set instance ID the rate belongs to.
- get_label() : string
- Set rate label.
- get_meta_data() : array
- Get all meta data for this rate.
- get_method_id() : string
- Set shipping method ID the rate belongs to.
- get_shipping_tax() : array
- Get shipping tax.
- get_taxes() : array
- Set rate taxes.
- set_cost() : mixed
- Set rate cost.
- set_id() : mixed
- Set ID for the rate. This is usually a combination of the method and instance IDs.
- set_instance_id() : mixed
- Set instance ID the rate belongs to.
- set_label() : mixed
- Set rate label.
- set_method_id() : mixed
- Set shipping method ID the rate belongs to.
- set_taxes() : mixed
- Set rate taxes.
Properties
$data
Stores data for this rate.
protected
array
$data
= array('id' => '', 'method_id' => '', 'instance_id' => 0, 'label' => '', 'cost' => 0, 'taxes' => array())
Tags
$meta_data
Stores meta data for this rate.
protected
array
$meta_data
= array()
Tags
Methods
__construct()
Constructor.
public
__construct([string $id = '' ][, string $label = '' ], int $cost[, array $taxes = array() ][, string $method_id = '' ], int $instance_id) : mixed
Parameters
- $id : string = ''
-
Shipping rate ID.
- $label : string = ''
-
Shipping rate label.
- $cost : int
-
Cost.
- $taxes : array = array()
-
Taxes applied to shipping rate.
- $method_id : string = ''
-
Shipping method ID.
- $instance_id : int
-
Shipping instance ID.
Return values
mixed__get()
Magic methods to support direct access to props.
public
__get(string $key) : mixed
Parameters
- $key : string
-
Key.
Tags
Return values
mixed__isset()
Magic methods to support direct access to props.
public
__isset(string $key) : bool
Parameters
- $key : string
-
Key.
Tags
Return values
bool__set()
Magic methods to support direct access to props.
public
__set(string $key, mixed $value) : mixed
Parameters
- $key : string
-
Key.
- $value : mixed
-
Value.
Tags
Return values
mixedadd_meta_data()
Add some meta data for this rate.
public
add_meta_data(string $key, string $value) : mixed
Parameters
- $key : string
-
Key.
- $value : string
-
Value.
Tags
Return values
mixedget_cost()
Set rate cost.
public
get_cost() : string
Tags
Return values
stringget_id()
Set ID for the rate. This is usually a combination of the method and instance IDs.
public
get_id() : string
Tags
Return values
stringget_instance_id()
Set instance ID the rate belongs to.
public
get_instance_id() : int
Tags
Return values
intget_label()
Set rate label.
public
get_label() : string
Return values
stringget_meta_data()
Get all meta data for this rate.
public
get_meta_data() : array
Tags
Return values
arrayget_method_id()
Set shipping method ID the rate belongs to.
public
get_method_id() : string
Tags
Return values
stringget_shipping_tax()
Get shipping tax.
public
get_shipping_tax() : array
Return values
arrayget_taxes()
Set rate taxes.
public
get_taxes() : array
Tags
Return values
arrayset_cost()
Set rate cost.
public
set_cost(string $cost) : mixed
Parameters
- $cost : string
-
Shipping rate cost.
Tags
Return values
mixedset_id()
Set ID for the rate. This is usually a combination of the method and instance IDs.
public
set_id(string $id) : mixed
Parameters
- $id : string
-
Shipping rate ID.
Tags
Return values
mixedset_instance_id()
Set instance ID the rate belongs to.
public
set_instance_id(int $instance_id) : mixed
Parameters
- $instance_id : int
-
Instance ID.
Tags
Return values
mixedset_label()
Set rate label.
public
set_label(string $label) : mixed
Parameters
- $label : string
-
Shipping rate label.
Tags
Return values
mixedset_method_id()
Set shipping method ID the rate belongs to.
public
set_method_id(string $method_id) : mixed
Parameters
- $method_id : string
-
Shipping method ID.
Tags
Return values
mixedset_taxes()
Set rate taxes.
public
set_taxes(array $taxes) : mixed
Parameters
- $taxes : array
-
List of taxes applied to shipping rate.