Metafield
Metafields enable you to attach additional information to a Shopify resource, such as a Product or a Collection. For more information about where you can attach metafields refer to HasMetafields. Some examples of the data that metafields enable you to store are specifications, size charts, downloadable documents, release dates, images, or part numbers. Metafields are identified by an owner resource, namespace, and key. and store a value along with type information for that value.
Anchor to Fields and connectionsFields and connections
- Anchor to compareDigestcompare•
Digest String!non-null The data stored in the resource, represented as a digest.
- Anchor to createdAtcreated•
At DateTime! non-null The date and time when the metafield was created.
- Anchor to definitiondefinition•
The metafield definition that the metafield belongs to, if any.
- Anchor to descriptiondescription•
The description of the metafield.
- •ID!non-null
A globally-unique ID.
- Anchor to jsonValuejson•
Value JSON!non-null The data stored in the metafield in JSON format.
- •String!non-null
The unique identifier for the metafield within its namespace.
- Anchor to legacyResourceIdlegacy•
Resource Id UnsignedInt64! non-null The ID of the corresponding resource in the REST Admin API.
- Anchor to namespacenamespace•String!non-null
The container for a group of metafields that the metafield is associated with.
- Anchor to ownerowner•Has
Metafields! non-null The resource that the metafield is attached to.
- Anchor to ownerTypeowner•
Type MetafieldOwner non-nullType! The type of resource that the metafield is attached to.
- Anchor to referencereference•
Returns a reference object if the metafield definition's type is a resource reference.
- Anchor to referencesreferences•
A list of reference objects if the metafield's type is a resource reference list.
- Anchor to typetype•String!non-null
The type of data that is stored in the metafield. Refer to the list of supported types.
- Anchor to updatedAtupdated•
At DateTime! non-null The date and time when the metafield was updated.
- Anchor to valuevalue•String!non-null
The data stored in the metafield. Always stored as a string, regardless of the metafield's type.
Map
Fields and connections with this object
- AppInstallation.metafield
- AppInstallation.metafields
- Article.metafield
- Article.metafields
- Blog.metafield
- Blog.metafields
- CartTransform.metafield
- CartTransform.metafields
- Collection.metafield
- Collection.metafields
- Company.metafield
- Company.metafields
- CompanyLocation.metafield
- CompanyLocation.metafields
- Customer.metafield
- Customer.metafields
- CustomerSegmentMember.metafield
- CustomerSegmentMember.metafields
- DeliveryCustomization.metafield
- DeliveryCustomization.metafields
- DiscountAutomaticNode.metafield
- DiscountAutomaticNode.metafields
- DiscountCodeNode.metafield
- DiscountCodeNode.metafields
- DiscountNode.metafield
- DiscountNode.metafields
- DraftOrder.metafield
- DraftOrder.metafields
- FulfillmentConstraintRule.metafield
- FulfillmentConstraintRule.metafields
Anchor to MutationsMutations
- •mutation
Sets metafield values. Metafield values will be set regardless if they were previously created or not.
Allows a maximum of 25 metafields to be set at a time.
This operation is atomic, meaning no changes are persisted if an error is encountered.
As of
2024-07
, this operation supports compare-and-set functionality to better handle concurrent requests. Ifis set for any metafield, the mutation will only set that metafield if the persisted metafield value matches the digest used on
. If the metafield doesn't exist yet, but you want to guarantee that the operation will run in a safe manner, set
to
null
. Thevalue can be acquired by querying the metafield object and selecting
as a field. If the
value does not match the digest for the persisted value, the mutation will return an error. You can opt out of write guarantees by not sending
in the request.