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