WC_Order_Item_Data_Store_Interface
in
WC Order Item Data Store Interface
Functions that must be defined by the order item data store (for functions).
Tags
Table of Contents
- add_metadata() : int
- Add term meta.
- add_order_item() : int
- Add an order item to an order.
- delete_metadata() : bool
- Delete term meta.
- delete_order_item() : mixed
- Delete an order item.
- get_metadata() : mixed
- Get term meta.
- get_order_id_by_order_item_id() : int
- Get order ID by order item ID.
- get_order_item_type() : string
- Get the order item type based on Item ID.
- update_metadata() : bool
- Update term meta.
- update_order_item() : bool
- Update an order item.
Methods
add_metadata()
Add term meta.
public
add_metadata(int $item_id, string $meta_key, mixed $meta_value[, bool $unique = false ]) : int
Parameters
- $item_id : int
-
Item ID.
- $meta_key : string
-
Meta key.
- $meta_value : mixed
-
Meta value.
- $unique : bool = false
-
Unique? (default: false).
Return values
int — New row ID or 0add_order_item()
Add an order item to an order.
public
add_order_item(int $order_id, array<string|int, mixed> $item) : int
Parameters
- $order_id : int
-
Order ID.
- $item : array<string|int, mixed>
-
order_item_name and order_item_type.
Return values
int — Order Item IDdelete_metadata()
Delete term meta.
public
delete_metadata(int $item_id, string $meta_key[, mixed $meta_value = '' ][, bool $delete_all = false ]) : bool
Parameters
- $item_id : int
-
Item ID.
- $meta_key : string
-
Meta key.
- $meta_value : mixed = ''
-
Meta value (default: '').
- $delete_all : bool = false
-
Delete all matching entries? (default: false).
Return values
bool —delete_order_item()
Delete an order item.
public
delete_order_item(int $item_id) : mixed
Parameters
- $item_id : int
-
Item ID.
Return values
mixed —get_metadata()
Get term meta.
public
get_metadata(int $item_id, string $key[, bool $single = true ]) : mixed
Parameters
- $item_id : int
-
Item ID.
- $key : string
-
Meta key.
- $single : bool = true
-
Store as single value and not serialised (default: true).
Return values
mixed —get_order_id_by_order_item_id()
Get order ID by order item ID.
public
get_order_id_by_order_item_id(int $item_id) : int
Parameters
- $item_id : int
-
Item ID.
Return values
int —get_order_item_type()
Get the order item type based on Item ID.
public
get_order_item_type(int $item_id) : string
Parameters
- $item_id : int
-
Item ID.
Return values
string —update_metadata()
Update term meta.
public
update_metadata(int $item_id, string $meta_key, mixed $meta_value[, string $prev_value = '' ]) : bool
Parameters
- $item_id : int
-
Item ID.
- $meta_key : string
-
Meta key.
- $meta_value : mixed
-
Meta value.
- $prev_value : string = ''
-
Previous value (default: '').
Return values
bool —update_order_item()
Update an order item.
public
update_order_item(int $item_id, array<string|int, mixed> $item) : bool
Parameters
- $item_id : int
-
Item ID.
- $item : array<string|int, mixed>
-
order_item_name or order_item_type.