WooCommerce Code Reference

Search results

WC_Order_Item_Data_Store implements WC_Order_Item_Data_Store_Interface

WC Order Item Data Store: Misc Order Item Data functions.

Table of Contents

add_order_item() Add an order item to an order. int
update_order_item() Update an order item. bool
delete_order_item() Delete an order item. mixed
update_metadata() Update term meta. bool
add_metadata() Add term meta. int
delete_metadata() Delete term meta. bool
get_metadata() Get term meta. mixed
get_order_id_by_order_item_id() Get order ID by order item ID. int
get_order_item_type() Get the order item type based on Item ID. string|null
clear_caches() Clear meta cache. mixed

Methods

add_order_item()

Add an order item to an order.

public add_order_item( $order_id : int , $item : array ) : int
Parameters
$order_id : int

Order ID.

$item : array

order_item_name and order_item_type.

Tags
since
Return values
int

Order Item ID

update_order_item()

Update an order item.

public update_order_item( $item_id : int , $item : array ) : bool
Parameters
$item_id : int

Item ID.

$item : array

order_item_name or order_item_type.

Tags
since
Return values
bool

delete_order_item()

Delete an order item.

public delete_order_item( $item_id : int ) : mixed
Parameters
$item_id : int

Item ID.

Tags
since
Return values
mixed

update_metadata()

Update term meta.

public update_metadata( $item_id : int , $meta_key : string , $meta_value : mixed [, $prev_value : string = '' ] ) : bool
Parameters
$item_id : int

Item ID.

$meta_key : string

Meta key.

$meta_value : mixed

Meta value.

$prev_value : string = ''

(default: '').

Tags
since
Return values
bool

add_metadata()

Add term meta.

public add_metadata( $item_id : int , $meta_key : string , $meta_value : mixed [, $unique : bool = false ] ) : int
Parameters
$item_id : int

Item ID.

$meta_key : string

Meta key.

$meta_value : mixed

Meta value.

$unique : bool = false

(default: false).

Tags
since
Return values
int

New row ID or 0

delete_metadata()

Delete term meta.

public delete_metadata( $item_id : int , $meta_key : string [, $meta_value : string = '' ] [, $delete_all : bool = false ] ) : bool
Parameters
$item_id : int

Item ID.

$meta_key : string

Meta key.

$meta_value : string = ''

(default: '').

$delete_all : bool = false

(default: false).

Tags
since
Return values
bool

get_metadata()

Get term meta.

public get_metadata( $item_id : int , $key : string [, $single : bool = true ] ) : mixed
Parameters
$item_id : int

Item ID.

$key : string

Meta key.

$single : bool = true

(default: true).

Tags
since
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( $item_id : int ) : int
Parameters
$item_id : int

Item ID.

Tags
since
Return values
int

get_order_item_type()

Get the order item type based on Item ID.

public get_order_item_type( $item_id : int ) : string|null
Parameters
$item_id : int

Item ID.

Tags
since
Return values
string|null

Order item type or null if no order item entry found.

clear_caches()

Clear meta cache.

protected clear_caches( $item_id : int , $order_id : int|null ) : mixed
Parameters
$item_id : int

Item ID.

$order_id : int|null

Order ID. If not set, it will be loaded using the item ID.

Return values
mixed
Back to the top