WooCommerce Code Reference

Experimental extends Metadata
in package

Marks a code-API element as experimental: present in the schema, but not stable enough to be relied on in production.

Discoverable through the _apiMetadata GraphQL field as an entry with name = "experimental" and value = true. The marking is informational: it does not gate access in any way.

When a class, property or enum case has this attribute, the generated GraphQL description is prefixed with [Experimental] , and when the element has no #[Description] at all, a default body ([Experimental] Not to be used in production environments.) is emitted so the marker still reaches stock introspection.

#[Experimental] on a class marks only that class: its fields and enum cases are not implicitly marked too. A tool that wants to treat the contents of an experimental type as experimental by association must apply that rule itself when it reads the metadata.

The attribute targets classes, properties, and enum cases; see {@see} for the reasoning behind excluding methods.

Table of Contents

__construct()  : mixed
Construct an `experimental` metadata entry with value `true`.
get_name()  : string
The entry's name (e.g. `internal`, `beta`, `owner`).
get_value()  : bool|int|float|string|null
The entry's scalar value.
shows_in_metadata_query()  : bool
Whether the element carrying this attribute should appear in the `_apiMetadata` discovery query.
transform_description()  : string
Prepend `[Experimental] ` to the description, supplying a default body when the element has no `#[Description]` of its own. See {@see Metadata::transform_description()} for the contract.

Methods

get_value()

The entry's scalar value.

public get_value() : bool|int|float|string|null
Return values
bool|int|float|string|null

shows_in_metadata_query()

Whether the element carrying this attribute should appear in the `_apiMetadata` discovery query.

public shows_in_metadata_query() : bool

Returning false removes the element's row entirely from _apiMetadata — neither this metadata entry nor any other descriptor on the same target surfaces. The runtime gates and any description transforms are unaffected. Useful for plugins that attach internal routing or feature hints they prefer not to broadcast through the discovery channel.

Despite the colloquial naming around it, this has nothing to do with native GraphQL introspection (__schema / __type); those queries continue to expose the schema's shape as usual.

Because this is an instance method, subclasses can decide conditionally based on their own constructor arguments.

Return values
bool

transform_description()

Prepend `[Experimental] ` to the description, supplying a default body when the element has no `#[Description]` of its own. See {@see Metadata::transform_description()} for the contract.

public transform_description(string $description) : string
Parameters
$description : string

Incoming description (empty when no #[Description]).

Return values
string