WooCommerce Code Reference

WC_Interactivity_Initial_State
in package

Manages the initial state of the Interactivity API store in the server and its serialization so it can be restored in the browser upon hydration.

It's a private class, exposed by other functions, like wc_initial_state.

Tags
access

private

Table of Contents

$initial_state  : array<string|int, mixed>
Map of initial state by namespace.
get_state()  : array<string|int, mixed>
Get state from a given namespace.
merge_state()  : void
Merge data into the state with the given namespace.
render()  : mixed
Render the initial state.
reset()  : mixed
Reset the initial state.

Properties

Methods

merge_state()

Merge data into the state with the given namespace.

public static merge_state(string $namespace, array<string|int, mixed> $data) : void
Parameters
$namespace : string

Namespace.

$data : array<string|int, mixed>

State to merge.

Return values
void