Metafield object

Metafields represent custom metadata attached to a resource. Metafields can be sorted into namespaces and are composed of keys, values, and value types.


On this page


Fields

  • createdAt ([DateTime!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#datetime-2021-01))
    The date and time when the metafield was created.
  • description ([String](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The description of a metafield.
  • id ([ID!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01))
    Globally unique identifier.
  • key ([String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The key name for a metafield.
  • legacyResourceId ([UnsignedInt64!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#unsignedint64-2021-01))
    The ID of the corresponding resource in the REST Admin API.
  • namespace ([String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The namespace for a metafield.
  • ownerType ([MetafieldOwnerType!](https://shopify.dev/docs/admin-api/graphql/reference/metafields/metafieldownertype))
    Owner type of a metafield visible to the Storefront API.
  • updatedAt ([DateTime!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#datetime-2021-01))
    The date and time when the metafield was updated.
  • value ([String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01))
    The value of a metafield.
  • valueType ([MetafieldValueType!](https://shopify.dev/docs/admin-api/graphql/reference/metafields/metafieldvaluetype))
    Represents the metafield value type.


Types that return Metafield

  • [Collection.metafield](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/collection#metafield-2021-01)
  • [Collection.metafields](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/collection#metafields-2021-01)
  • [Customer.metafield](https://shopify.dev/docs/admin-api/graphql/reference/customers/customer#metafield-2021-01)
  • [Customer.metafields](https://shopify.dev/docs/admin-api/graphql/reference/customers/customer#metafields-2021-01)
  • [DraftOrder.metafield](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorder#metafield-2021-01)
  • [DraftOrder.metafields](https://shopify.dev/docs/admin-api/graphql/reference/orders/draftorder#metafields-2021-01)
  • [Image.metafield](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/image#metafield-2021-01)
  • [Image.metafields](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/image#metafields-2021-01)
  • [Order.metafield](https://shopify.dev/docs/admin-api/graphql/reference/orders/order#metafield-2021-01)
  • [Order.metafields](https://shopify.dev/docs/admin-api/graphql/reference/orders/order#metafields-2021-01)
  • [Product.metafield](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/product#metafield-2021-01)
  • [Product.metafields](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/product#metafields-2021-01)
  • [ProductVariant.metafield](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/productvariant#metafield-2021-01)
  • [ProductVariant.metafields](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/productvariant#metafields-2021-01)
  • [Shop.metafield](https://shopify.dev/docs/admin-api/graphql/reference/store-properties/shop#metafield-2021-01)
  • [Shop.metafields](https://shopify.dev/docs/admin-api/graphql/reference/store-properties/shop#metafields-2021-01)


Mutations for Metafield


Implements

  • [LegacyInteroperability](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/legacyinteroperability)
  • [Node](https://shopify.dev/docs/admin-api/graphql/reference/common-objects/node)