Gravity_Forms\Gravity_Forms\Orders\Items\GF_Order_Item
Source: includes/orders/items/class-gf-order-item.php:7
Details
- Kind:
class - Namespace:
Gravity_Forms\Gravity_Forms\Orders\Items
Properties
| Property | Type | Description |
|---|---|---|
$data | array | A collection of item properties. |
Methods
| Method | Description |
|---|---|
__construct() | GF_Order_Item constructor. |
get_id() | Returns the item ID. |
get_base_price() | Returns the base price of the item. |
get_total() | Calculates the item final total. |
override_properties() | Overrides the item properties with a new set of properties. |
to_array() | Returns the item properties as an array. |
__get() | Returns a property from the item's data. |
__set() | Sets the value of a property in the item's data. |
Method Reference
__construct()
public function __construct( $id, $data=[] )
GF_Order_Item constructor.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$id | string | int | The item ID. | |
$data | array | [] | The item data. |
Since: 2.6
Source: includes/orders/items/class-gf-order-item.php:65
get_id()
public function get_id()
Returns the item ID.
Returns
int|string— The item ID
Since: 2.6
Source: includes/orders/items/class-gf-order-item.php:87
get_base_price()
public function get_base_price()
Returns the base price of the item.
Returns
float
Since: 2.6
Source: includes/orders/items/class-gf-order-item.php:98
get_total()
public function get_total()
Calculates the item final total.
Returns
float|int— The item final total.
Since: 2.6
Source: includes/orders/items/class-gf-order-item.php:110
override_properties()
public final function override_properties( $data, $except=[] )
Overrides the item properties with a new set of properties.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$data | array | The new data. | |
$except | array | [] | A group of keys to be skipped while overriding. |
Since: 2.6
Source: includes/orders/items/class-gf-order-item.php:125
to_array()
public final function to_array()
Returns the item properties as an array.
Returns
array— The item properties
Since: 2.6
Source: includes/orders/items/class-gf-order-item.php:147
__get()
public final function __get( $key )
Returns a property from the item's data.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | The property name to look for. |
Returns
mixed|null— The property value or null if nothing found.
Since: 2.6
Source: includes/orders/items/class-gf-order-item.php:170
__set()
public final function __set( $key, $value )
Sets the value of a property in the item's data.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | The property name to look for. | |
$value | mixed | The property value. |
Since: 2.6
Source: includes/orders/items/class-gf-order-item.php:187