WooCommerce Code Reference

WC_Order_Item_Data_Store_Interface

WC Order Item Data Store Interface

Functions that must be defined by the order item data store (for functions).

Tags
version
3.0.0

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
intNew row ID or 0

add_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
intOrder Item ID

delete_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

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

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.

Return values
bool