WooCommerce Code Reference

WC_Order_Item_Meta
in package

Order item meta class.

Table of Contents

$meta  : array|null
Post meta data
$product  : WC_Product|null
Product object.
$item  : array|null
Order item
$legacy  : bool
For handling backwards compatibility.
__construct()  : mixed
Constructor.
display()  : string|void
Display meta in a formatted list.
get_formatted()  : array
Return an array of formatted item meta in format e.g.
get_formatted_legacy()  : array
Return an array of formatted item meta in format e.g.

Properties

Methods

display()

Display meta in a formatted list.

public display([bool $flat = false ][, bool $return = false ][, string $hideprefix = '_' ][, string $delimiter = ", " ]) : string|void
Parameters
$flat : bool = false

Flat (default: false).

$return : bool = false

Return (default: false).

$hideprefix : string = '_'

Hide prefix (default: _).

$delimiter : string = ", "

Delimiter used to separate items when $flat is true.

Return values
string|void

get_formatted()

Return an array of formatted item meta in format e.g.

public get_formatted([string $hideprefix = '_' ]) : array

Returns: array( 'pa_size' => array( 'label' => 'Size', 'value' => 'Medium', ) )

Parameters
$hideprefix : string = '_'

exclude meta when key is prefixed with this, defaults to '_'.

Tags
since
2.4
Return values
array

get_formatted_legacy()

Return an array of formatted item meta in format e.g.

public get_formatted_legacy([string $hideprefix = '_' ]) : array

Handles @deprecated args.

Parameters
$hideprefix : string = '_'

Hide prefix.

Return values
array