Skip to main content

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

PropertyTypeDescription
$dataarrayA collection of item properties.

Methods

MethodDescription
__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

NameTypeDefaultDescription
$idstring | intThe item ID.
$dataarray[]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

NameTypeDefaultDescription
$dataarrayThe new data.
$exceptarray[]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

NameTypeDefaultDescription
$keystringThe 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

NameTypeDefaultDescription
$keystringThe property name to look for.
$valuemixedThe property value.

Since: 2.6

Source: includes/orders/items/class-gf-order-item.php:187