Metafield Definition
Metafield definitions enable you to define additional validation constraints for metafields, and enable the merchant to edit metafield values in context.
Anchor to Fields and connectionsFields and connections
- Anchor to accessaccess•Metafield
Access!non-null The access settings associated with the metafield definition.
- Anchor to capabilitiescapabilities•Metafield
Capabilities!non-null The capabilities of the metafield definition.
- Anchor to constraintsconstraints•Metafield
Definition Constraints The constraints that determine what subtypes of resources a metafield definition applies to.
- Anchor to descriptiondescription•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.
- Anchor to metafieldsmetafields•Metafield
Connection!non-null The metafields that belong to the metafield definition.
- Anchor to metafieldsCountmetafields•Int!non-null
Count The count of the metafields that belong to the metafield definition.
- Anchor to namename•String!non-null
The human-readable name of the metafield definition.
- Anchor to namespacenamespace•String!non-null
The container for a group of metafields that the metafield definition is associated with.
- Anchor to ownerTypeowner•Metafield
Type Owner Type!non-null The resource type that the metafield definition is attached to.
- Anchor to pinnedPositionpinned•Int
Position The position of the metafield definition in the pinned list.
- Anchor to standardTemplatestandard•Standard
Template Metafield Definition Template The standard metafield definition template associated with the metafield definition.
- Anchor to typetype•Metafield
Definition Type!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.
- Anchor to useAsCollectionConditionuse•Boolean!non-null
As Collection Condition Whether the metafield definition can be used as a collection condition.
- Anchor to validationsvalidations•[Metafield
Definition Validation!]!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.- Anchor to validationStatusvalidation•Metafield
Status Definition Validation Status!non-null The validation status for the metafields that belong to the metafield definition.
Anchor to QueriesQueries
- •query
Returns a metafield definition by identifier.
- •query
Returns a list of metafield definitions.
Anchor to MutationsMutations
- •mutation
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.
- Anchor to definitiondefinition•Metafield
Definition Input!required Specifies the input fields for a metafield definition.
Arguments
- Anchor to createdDefinitioncreated•Metafield
Definition Definition The metafield definition that was created.
- Anchor to userErrorsuser•[Metafield
Errors Definition Create User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields
- •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.
- Anchor to definitionIddefinition•ID!required
Id The ID of the metafield definition to pin.
Arguments
- Anchor to pinnedDefinitionpinned•Metafield
Definition Definition The metafield definition that was pinned.
- Anchor to userErrorsuser•[Metafield
Errors Definition Pin User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields
- •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.
- Anchor to definitionIddefinition•ID!required
Id The ID of the metafield definition to unpin.
Arguments
- Anchor to unpinnedDefinitionunpinned•Metafield
Definition Definition The metafield definition that was unpinned.
- Anchor to userErrorsuser•[Metafield
Errors Definition Unpin User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields
- •mutation
Updates a metafield definition.
- Anchor to definitiondefinition•Metafield
Definition Update Input!required The input fields for the metafield definition update.
Arguments
- Anchor to updatedDefinitionupdated•Metafield
Definition Definition The metafield definition that was updated.
- Anchor to userErrorsuser•[Metafield
Errors Definition Update User Error!]!non-null The list of errors that occurred from executing the mutation.
- Anchor to validationJobvalidation•Job
Job The asynchronous job updating the metafield definition's validation_status.
Fields
- •mutation
Activates the specified standard metafield definition from its template.
Refer to the list of standard metafield definition templates.
- Anchor to accessaccess•Standard
Metafield Definition Access Input The access settings that apply to each of the metafields that belong to the metafield definition.
- Anchor to capabilitiescapabilities•Metafield
Capability Create Input The capabilities of the metafield definition.
- •ID
The ID of the standard metafield definition template to enable.
- •String
The key of the standard metafield to enable. Used in combination with
namespace
.- Anchor to namespacenamespace•String
The namespace of the standard metafield to enable. Used in combination with
key
.- Anchor to ownerTypeowner•Metafield
Type Owner Type!required The resource type that the metafield definition is scoped to.
- •Boolean!requiredDefault:false
Whether to pin the metafield definition.
- Anchor to useAsCollectionConditionuse•BooleanDeprecatedDefault:false
As Collection Condition - Anchor to visibleToStorefrontApivisible•BooleanDeprecatedDefault:null
To Storefront Api
Arguments
- Anchor to createdDefinitioncreated•Metafield
Definition Definition The metafield definition that was created.
- Anchor to userErrorsuser•[Standard
Errors Metafield Definition Enable User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields