Metafield definitions enable you to define additional validation constraints for metafields, and enable the
merchant to edit metafield values in context.
Access Scopes
Fields
access:
MetafieldAccess! -
The access settings associated with the metafield definition.
capabilities:
MetafieldCapabilities! -
The capabilities of the metafield definition.
constraints:
MetafieldDefinitionConstraints -
The constraints that determine what subtypes of resources a metafield definition applies to.
description:
String -
The description of the metafield definition.
key:
String! -
The unique identifier for the metafield definition within its namespace.
metafieldsCount:
Int! -
The count of the metafields that belong to the metafield definition.
name:
String! -
The human-readable name of the metafield definition.
namespace:
String! -
The container for a group of metafields that the metafield definition is associated with.
ownerType:
MetafieldOwnerType! -
The resource type that the metafield definition is attached to.
pinnedPosition:
Int -
The position of the metafield definition in the pinned list.
standardTemplate:
StandardMetafieldDefinitionTemplate -
The standard metafield definition template associated with the metafield definition.
type:
MetafieldDefinitionType! -
The type of data that each of the metafields that belong to the metafield definition will store.
Refer to the list of [supported types](https://shopify.dev/apps/metafields/types).
useAsCollectionCondition:
Boolean! -
Whether the metafield definition can be used as a collection condition.
validationStatus:
MetafieldDefinitionValidationStatus! -
The validation status for the metafields that belong to the metafield definition.
validations:
MetafieldDefinitionValidation! -
A list of [validation options](https://shopify.dev/apps/metafields/definitions/validation) 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.
visibleToStorefrontApi:
Boolean! -
Whether each of the metafields that belong to the metafield definition are visible from the Storefront API.
metafieldDefinitionCreate
Creates a metafield definition. Any metafields existing under the same owner type, namespace, and key will be
checked against this definition and will have their type updated accordingly. For metafields that are not
valid, they will remain unchanged but any attempts to update them must align with this definition.
metafieldDefinitionPin
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.
metafieldDefinitionUnpin
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.
standardMetafieldDefinitionEnable
Activates the specified standard metafield definition from its template.
Refer to the [list of standard metafield definition templates](https://shopify.dev/apps/metafields/definitions/standard-definitions).