Gravity_Forms\Gravity_Forms\Orders\GF_Order
Source: includes/orders/class-gf-order.php:8
Details
- Kind:
class - Namespace:
Gravity_Forms\Gravity_Forms\Orders
Properties
| Property | Type | Description |
|---|---|---|
$currency | string | The order currency. |
Methods
| Method | Description |
|---|---|
add_items() | Adds a group of items to the order. |
add_item() | Adds a single item to the order. |
get_items() | Returns a collection of items by item type or all items. |
get_items_by_class_type() | Returns a collection of items by item class type. |
get_items_exclude_class_type() | Returns a collection of items excluding a certain class type. |
delete_item() | Deletes an item from the order. |
get_item() | Gets an item from the order. |
get_item_by_property() | Searches for an item by a property and its values and returns the first found item. |
get_group() | Returns the order items in a certain group. |
get_groups() | Returns the order groups. |
get_totals() | Calculates the order totals. |
Method Reference
add_items()
public function add_items( $items=[] )
Adds a group of items to the order.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$items | GF_Order_Item[] | [] |
Since: 2.6
Source: includes/orders/class-gf-order.php:61
add_item()
public function add_item( $item )
Adds a single item to the order.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$item | GF_Order_Item |
Returns
bool
Since: 2.6
Source: includes/orders/class-gf-order.php:76
get_items()
public function get_items( $type=null )
Returns a collection of items by item type or all items.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$type | null | string | null | The item type to look for. |
Returns
array|GF_Order_Item— An empty array if no items found or the items.
Since: 2.6
Source: includes/orders/class-gf-order.php:114
get_items_by_class_type()
public function get_items_by_class_type( $type )
Returns a collection of items by item class type.
Item types can be represented by a string, for example a collection of GF_Form_Product_Item added to a type called "recurring".
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$type | string | The item class to look for. |
Returns
array|GF_Order_Item— An empty array if no items found or the items.
Since: 2.6
Source: includes/orders/class-gf-order.php:141
get_items_exclude_class_type()
public function get_items_exclude_class_type( $type )
Returns a collection of items excluding a certain class type.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$type | string | The item class to look for. |
Returns
array|GF_Order_Item— An empty array if no items found or the items.
Since: 2.6
Source: includes/orders/class-gf-order.php:162
delete_item()
public function delete_item( $id )
Deletes an item from the order.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$id | string | The item ID. |
Returns
bool
Since: 2.6
Source: includes/orders/class-gf-order.php:177
get_item()
public function get_item( $id )
Gets an item from the order.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$id | string | The item ID. |
Returns
false|GF_Order_Item— The found item or false.
Since: 2.6
Source: includes/orders/class-gf-order.php:199
get_item_by_property()
public function get_item_by_property( $property, $value )
Searches for an item by a property and its values and returns the first found item.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$property | string | The property name to look for. | |
$value | string | The property value to look for. |
Returns
false|GF_Order_Item— false if no items are found or the order item.
Since: 2.6
Source: includes/orders/class-gf-order.php:217
get_group()
public function get_group( $group )
Returns the order items in a certain group.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$group | string | The group to look for. |
Returns
array|GF_Order_Item— An empty array if no items found or the items.
Since: 2.6
Source: includes/orders/class-gf-order.php:256
get_groups()
public function get_groups()
Returns the order groups.
Returns
array[]
Since: 2.6
Source: includes/orders/class-gf-order.php:267
get_totals()
public function get_totals()
Calculates the order totals.
Returns
array— an assoc array that contains each total label and its value.
Since: 2.6
Source: includes/orders/class-gf-order.php:279