Skip to main content
object

Defines the structure, validation rules, and permissions for Metafield objects attached to a specific owner type. Each definition establishes a schema that metafields must follow, including the data type and validation constraints.

The definition controls access permissions across different APIs, determines whether the metafield can be used for filtering or as a collection condition, and can be constrained to specific resource subtypes.

•MetafieldAccess!
non-null

The access settings associated with the metafield definition.

•MetafieldCapabilities!
non-null

The capabilities of the metafield definition.

•MetafieldDefinitionConstraints

The constraints that determine what subtypes of resources a metafield definition applies to.

•DateTime!
non-null

The date and time when the metafield definition was created.

•String

The description of the metafield definition.

•ID!
non-null

A globally-unique ID.

•String!
non-null

The unique identifier for the metafield definition within its namespace.

•MetafieldConnection!
non-null

The metafields that belong to the metafield definition.

•Int!
non-null

The count of the metafields that belong to the metafield definition.

Arguments

•MetafieldValidationStatus

The current validation status.


•String!
non-null

The human-readable name of the metafield definition.

•String!
non-null

The container for a group of metafields that the metafield definition is associated with.

•MetafieldOwnerType!
non-null

The resource type that the metafield definition is attached to.

•Int

The position of the metafield definition in the pinned list.

•StandardMetafieldDefinitionTemplate

The standard metafield definition template associated with the metafield definition.

•MetafieldDefinitionType!
non-null

The type of data that each of the metafields that belong to the metafield definition will store. Refer to the list of supported types.

•DateTime!
non-null

The date and time when the metafield definition was updated.

Anchor to useAsCollectionConditionuseAsCollectionCondition
•Boolean!
non-null

Whether the metafield definition can be used as a collection condition.

•[MetafieldDefinitionValidation!]!
non-null

A list of validation options for the metafields that belong to the metafield definition. For example, for a metafield definition with the type date, you can set a minimum date validation so that each of the metafields that belong to it can only store dates after the specified minimum.

•MetafieldDefinitionValidationStatus!
non-null

The validation status for the metafields that belong to the metafield definition.


Was this section helpful?

•query

Retrieves a MetafieldDefinition by its identifier. You can identify a definition using either its owner type, namespace, and key, or its global ID.

Use this query to inspect a definition's configuration, including its data type, validations, access settings, and the count of metafields using it.

•query

Returns a list of metafield definitions.


Was this section helpful?

•mutation

Creates a MetafieldDefinition that establishes structure and validation rules for metafields. The definition specifies the data type, validation constraints, and access permissions for metafields with a given namespace and key combination.

When you create a new definition, the system validates any existing unstructured metafields matching the same owner type, namespace, and key against it. The system updates each valid metafield's type to match the definition. Invalid metafields remain unchanged but must conform to the definition when updated.

Learn more about creating metafield definitions.

•mutation

You can organize your metafields in your Shopify admin by pinning/unpinning metafield definitions. The order of your pinned metafield definitions determines the order in which your metafields are displayed on the corresponding pages in your Shopify admin. By default, only pinned metafields are automatically displayed.

•mutation

You can organize your metafields in your Shopify admin by pinning/unpinning metafield definitions. The order of your pinned metafield definitions determines the order in which your metafields are displayed on the corresponding pages in your Shopify admin. By default, only pinned metafields are automatically displayed.

•mutation

Updates a MetafieldDefinition's configuration and settings. You can modify the definition's name, description, validation rules, access settings, capabilities, and constraints.

The mutation updates access settings that control visibility across different APIs, such as the GraphQL Admin API, Storefront API, and Customer Account API. It also enables capabilities like admin filtering or unique value validation, and modifies constraints that determine which resource subtypes the definition applies to.


Note

The type, namespace, key, and owner type identify the definition and so can't be changed.


Learn more about updating metafield definitions.

•mutation

Activates the specified standard metafield definition from its template.

Refer to the list of standard metafield definition templates.

•mutation

Enables multiple specified standard metafield definitions from their templates as a single transaction. This API is idempotent so any previously-enabled standard definitions will not cause a failure. However, invalid inputs or other user errors will prevent all of the requested definitions from being enabled.

Refer to the list of standard metafield definition templates.


Was this section helpful?

•interface

Was this section helpful?