WC_Shipping_Rate
in package
Shipping rate class.
Table of Contents
- $data : array<string|int, mixed>
- Stores data for this rate.
- $meta_data : array<string|int, mixed>
- 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
- Get rate cost.
- get_id() : string
- Get ID for the rate. This is usually a combination of the method and instance IDs.
- get_instance_id() : int
- Get instance ID the rate belongs to.
- get_label() : string
- Get rate label.
- get_meta_data() : array<string|int, mixed>
- Get all meta data for this rate.
- get_method_id() : string
- Get shipping method ID the rate belongs to.
- get_shipping_tax() : float
- Get shipping tax.
- get_taxes() : array<string|int, mixed>
- Get 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<string|int, mixed>
$data
= array('id' => '', 'method_id' => '', 'instance_id' => 0, 'label' => '', 'cost' => 0, 'taxes' => array())
Tags
$meta_data
Stores meta data for this rate.
protected
array<string|int, mixed>
$meta_data
= array()
Tags
Methods
__construct()
Constructor.
public
__construct([string $id = '' ][, string $label = '' ], int $cost[, array<string|int, mixed> $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<string|int, mixed> = 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
mixed —add_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
mixed —get_cost()
Get rate cost.
public
get_cost() : string
Tags
Return values
string —get_id()
Get ID for the rate. This is usually a combination of the method and instance IDs.
public
get_id() : string
Tags
Return values
string —get_instance_id()
Get instance ID the rate belongs to.
public
get_instance_id() : int
Tags
Return values
int —get_label()
Get rate label.
public
get_label() : string
Return values
string —get_meta_data()
Get all meta data for this rate.
public
get_meta_data() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —get_method_id()
Get shipping method ID the rate belongs to.
public
get_method_id() : string
Tags
Return values
string —get_shipping_tax()
Get shipping tax.
public
get_shipping_tax() : float
Return values
float —get_taxes()
Get rate taxes.
public
get_taxes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —set_cost()
Set rate cost.
public
set_cost(string $cost) : mixed
Parameters
- $cost : string
-
Shipping rate cost.
Tags
Return values
mixed —set_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
mixed —set_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
mixed —set_label()
Set rate label.
public
set_label(string $label) : mixed
Parameters
- $label : string
-
Shipping rate label.
Tags
Return values
mixed —set_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
mixed —set_taxes()
Set rate taxes.
public
set_taxes(array<string|int, mixed> $taxes) : mixed
Parameters
- $taxes : array<string|int, mixed>
-
List of taxes applied to shipping rate.