Skip to main content
object

Custom metadata attached to a Shopify resource such as a Product, Collection, or Customer. Each metafield is identified by a namespace and key, and stores a value with an associated type.

Values are always stored as strings, but the type field indicates how to interpret the data. When a metafield's type is a resource reference, use the reference or references fields to retrieve the linked objects. Access metafields on any resource that implements the HasMetafields interface.

•DateTime!
non-null

The date and time when the storefront metafield was created.

•String

The description of a metafield.

•ID!
non-null

A globally-unique ID.

•String!
non-null

The unique identifier for the metafield within its namespace.

•String!
non-null

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

•MetafieldParentResource!
non-null

The type of resource that the metafield is attached to.

•MetafieldReference

Returns a reference object if the metafield's type is a resource reference.

•MetafieldReferenceConnection

A list of reference objects if the metafield's type is a resource reference list.

Arguments

•Int

Returns up to the first n elements from the list.

•String

Returns the elements that come after the specified cursor.

•Int

Returns up to the last n elements from the list.

•String

Returns the elements that come before the specified cursor.


•String!
non-null

The type name of the metafield. Refer to the list of supported types.

•DateTime!
non-null

The date and time when the metafield was last updated.

•String!
non-null

The data stored in the metafield. Always stored as a string, regardless of the metafield's type.


Was this section helpful?

•mutation

Sets Metafield values on a cart, creating new metafields or updating existing ones. Accepts up to 25 metafields per request.

Cart metafields can automatically copy to order metafields when an order is created, if there's a matching order metafield definition with the cart to order copyable capability enabled.


Note

This mutation doesn't trigger Shopify Functions. Changes aren't available to Shopify Functions until the buyer goes to checkout or performs another cart interaction that triggers the functions.


Arguments

•[CartMetafieldsSetInput!]!
required

The list of Cart metafield values to set. Maximum of 25.

The input must not contain more than 250 values.



Was this section helpful?

•interface

Was this section helpful?