WooCommerce Code Reference

WC_Meta_Data
in package
implements JsonSerializable

Meta data class.

Interfaces, Classes and Traits

JsonSerializable

Table of Contents

$current_data  : array<string|int, mixed>
Current data for metadata
$data  : array<string|int, mixed>
Metadata data
__construct()  : mixed
Constructor.
__get()  : mixed
Returns the value of any property.
__isset()  : bool
Checks if a given key exists in our data. This is called internally by `empty` and `isset`.
__set()  : mixed
Creates or updates a property in the metadata object.
apply_changes()  : mixed
Merge changes with data and clear.
get_changes()  : array<string|int, mixed>
Return data changes only.
get_data()  : array<string|int, mixed>
Return all data as an array.
jsonSerialize()  : object|array<string|int, mixed>
When converted to JSON.

Properties

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $meta = array() ]) : mixed
Parameters
$meta : array<string|int, mixed> = array()

Data to wrap behind this function.

Return values
mixed

__get()

Returns the value of any property.

public __get(string $key) : mixed
Parameters
$key : string

Key to get.

Return values
mixedProperty value or NULL if it does not exists

__isset()

Checks if a given key exists in our data. This is called internally by `empty` and `isset`.

public __isset(string $key) : bool
Parameters
$key : string

Key to check if set.

Return values
bool

__set()

Creates or updates a property in the metadata object.

public __set(string $key, mixed $value) : mixed
Parameters
$key : string

Key to set.

$value : mixed

Value to set.

Return values
mixed

get_changes()

Return data changes only.

public get_changes() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_data()

Return all data as an array.

public get_data() : array<string|int, mixed>
Return values
array<string|int, mixed>

jsonSerialize()

When converted to JSON.

public jsonSerialize() : object|array<string|int, mixed>
Return values
object|array<string|int, mixed>