WooCommerce Code Reference

Parameter
in package

Declares an explicit GraphQL argument for a query or mutation.

Use this when the argument cannot be inferred from the execute() method signature — for example, when a parameter needs a specific GraphQL type, nullability, or default that differs from what reflection would produce. This attribute is repeatable: apply it once per argument.

Table of Contents

$has_default  : bool
Whether a default value was provided.
__construct()  : mixed
Constructor.

Properties

Methods

__construct()

Constructor.

public __construct([string $name = '' ][, string $type = '' ][, bool $nullable = false ][, bool $array = false ][, mixed $default = null ][, string $description = '' ][, bool $has_default = false ][, bool $unroll = false ]) : mixed
Parameters
$name : string = ''

The GraphQL argument name (not needed when unrolling).

$type : string = ''

The PHP type name ('int', 'string', 'float', 'bool') or a fully-qualified class name for complex types.

$nullable : bool = false

Whether the argument accepts null.

$array : bool = false

Whether the argument is a list (e.g. [Int!]).

$default : mixed = null

The default value if the argument is omitted.

$description : string = ''

Human-readable description for the schema.

$has_default : bool = false

Set to true to explicitly indicate a default is provided (needed when the default value is null).

$unroll : bool = false

When true, the class given in $type is expanded into individual GraphQL arguments (one per public property).

Return values
mixed