WC_Order_Factory
in package
Order factory class
Table of Contents
- get_class_names_for_order_ids() : array<string|int, mixed>
- Gets the class name bunch of order instances should have based on their IDs.
- get_order() : WC_Order|bool
- Get order.
- get_order_id() : int|bool
- Get the order ID depending on what was passed.
- get_order_item() : WC_Order_Item|false
- Get order item.
- get_orders() : mixed
- Get multiple orders (by ID).
- get_class_name_for_order_id() : string
- Gets the class name an order instance should have based on its ID.
- get_global_order_id() : false|int
- Try to determine the current order ID based on available global state.
Methods
get_class_names_for_order_ids()
Gets the class name bunch of order instances should have based on their IDs.
public
static get_class_names_for_order_ids(array<string|int, mixed> $order_ids) : array<string|int, mixed>
Parameters
- $order_ids : array<string|int, mixed>
-
Order IDs to get the class name for.
Return values
array<string|int, mixed> — Array of order_id => class_name.get_order()
Get order.
public
static get_order([mixed $order_id = false ]) : WC_Order|bool
Parameters
- $order_id : mixed = false
-
(default: false) Order ID to get.
Return values
WC_Order|bool —get_order_id()
Get the order ID depending on what was passed.
public
static get_order_id(mixed $order) : int|bool
Parameters
- $order : mixed
-
Order data to convert to an ID.
Tags
Return values
int|bool — false on failureget_order_item()
Get order item.
public
static get_order_item(int $item_id) : WC_Order_Item|false
Parameters
- $item_id : int
-
Order item ID to get.
Return values
WC_Order_Item|false — if not foundget_orders()
Get multiple orders (by ID).
public
static get_orders([mixed $order_ids = array() ][, bool $skip_invalid = false ]) : mixed
Parameters
- $order_ids : mixed = array()
-
Array of order IDs to get.
- $skip_invalid : bool = false
-
(default: false) TRUE if invalid IDs or orders should be ignored.
Tags
Return values
mixed —get_class_name_for_order_id()
Gets the class name an order instance should have based on its ID.
private
static get_class_name_for_order_id(int $order_id) : string
Parameters
- $order_id : int
-
The order ID.
Tags
Return values
string — The class name or FALSE if the class does not exist.get_global_order_id()
Try to determine the current order ID based on available global state.
private
static get_global_order_id() : false|int