---
title: Metafield - Storefront API
description: |
  [Custom metadata](https://shopify.dev/docs/apps/build/metafields) attached to a Shopify resource such as a [`Product`](/docs/api/storefront/2026-04/objects/Product), [`Collection`](/docs/api/storefront/2026-04/objects/Collection), or [`Customer`](/docs/api/storefront/2026-04/objects/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`](/docs/api/storefront/2026-04/objects/Metafield#field-Metafield.fields.type) field indicates how to interpret the data. When a metafield's type is a resource reference, use the [`reference`](/docs/api/storefront/2026-04/objects/Metafield#field-Metafield.fields.reference) or [`references`](/docs/api/storefront/2026-04/objects/Metafield#field-Metafield.fields.references) fields to retrieve the linked objects. Access metafields on any resource that implements the [`HasMetafields`](/docs/api/storefront/2026-04/interfaces/HasMetafields) interface.
api_version: 2026-04
source_url:
  html: https://shopify.dev/docs/api/storefront/latest/objects/metafield
  md: https://shopify.dev/docs/api/storefront/latest/objects/metafield.md
---

# Metafield

object

[Custom metadata](https://shopify.dev/docs/apps/build/metafields) attached to a Shopify resource such as a [`Product`](https://shopify.dev/docs/api/storefront/2026-04/objects/Product), [`Collection`](https://shopify.dev/docs/api/storefront/2026-04/objects/Collection), or [`Customer`](https://shopify.dev/docs/api/storefront/2026-04/objects/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`](https://shopify.dev/docs/api/storefront/2026-04/objects/Metafield#field-Metafield.fields.type) field indicates how to interpret the data. When a metafield's type is a resource reference, use the [`reference`](https://shopify.dev/docs/api/storefront/2026-04/objects/Metafield#field-Metafield.fields.reference) or [`references`](https://shopify.dev/docs/api/storefront/2026-04/objects/Metafield#field-Metafield.fields.references) fields to retrieve the linked objects. Access metafields on any resource that implements the [`HasMetafields`](https://shopify.dev/docs/api/storefront/2026-04/interfaces/HasMetafields) interface.

## Fields

* created​At

  [Date​Time!](https://shopify.dev/docs/api/storefront/latest/scalars/DateTime)

  non-null Token access required

  The date and time when the storefront metafield was created.

* description

  [String](https://shopify.dev/docs/api/storefront/latest/scalars/String)

  Token access required

  The description of a metafield.

* id

  [ID!](https://shopify.dev/docs/api/storefront/latest/scalars/ID)

  non-null Token access required

  A globally-unique ID.

* key

  [String!](https://shopify.dev/docs/api/storefront/latest/scalars/String)

  non-null Token access required

  The unique identifier for the metafield within its namespace.

* list

  [Boolean!](https://shopify.dev/docs/api/storefront/latest/scalars/Boolean)

  non-null Token access required

  Whether the metafield's type is a list type. Returns `true` for types like `list.color` or `list.single_line_text_field`.

* namespace

  [String!](https://shopify.dev/docs/api/storefront/latest/scalars/String)

  non-null Token access required

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

* parent​Resource

  [Metafield​Parent​Resource!](https://shopify.dev/docs/api/storefront/latest/unions/MetafieldParentResource)

  non-null Token access required

  The type of resource that the metafield is attached to.

* reference

  [Metafield​Reference](https://shopify.dev/docs/api/storefront/latest/unions/MetafieldReference)

  Token access required

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

* references

  [Metafield​Reference​Connection](https://shopify.dev/docs/api/storefront/latest/connections/MetafieldReferenceConnection)

  Token access required

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

  * first

    [Int](https://shopify.dev/docs/api/storefront/latest/scalars/Int)

    ### Arguments

    Returns up to the first `n` elements from the list.

  * after

    [String](https://shopify.dev/docs/api/storefront/latest/scalars/String)

    Returns the elements that come after the specified cursor.

  * last

    [Int](https://shopify.dev/docs/api/storefront/latest/scalars/Int)

    Returns up to the last `n` elements from the list.

  * before

    [String](https://shopify.dev/docs/api/storefront/latest/scalars/String)

    Returns the elements that come before the specified cursor.

  ***

* type

  [String!](https://shopify.dev/docs/api/storefront/latest/scalars/String)

  non-null Token access required

  The type name of the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/definitions/types).

* updated​At

  [Date​Time!](https://shopify.dev/docs/api/storefront/latest/scalars/DateTime)

  non-null Token access required

  The date and time when the metafield was last updated.

* value

  [String!](https://shopify.dev/docs/api/storefront/latest/scalars/String)

  non-null Token access required

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

***

## Map

### Fields with this object

* [Article.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Article#field-Article.fields.metafield)
* [Article.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Article#field-Article.fields.metafields)
* [Blog.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Blog#field-Blog.fields.metafield)
* [Blog.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Blog#field-Blog.fields.metafields)
* [Cart.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Cart#field-Cart.fields.metafield)
* [Cart.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Cart#field-Cart.fields.metafields)
* [Collection.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Collection#field-Collection.fields.metafield)
* [Collection.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Collection#field-Collection.fields.metafields)
* [Company.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Company#field-Company.fields.metafield)
* [Company.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Company#field-Company.fields.metafields)
* [CompanyLocation.metafield](https://shopify.dev/docs/api/storefront/latest/objects/CompanyLocation#field-CompanyLocation.fields.metafield)
* [CompanyLocation.metafields](https://shopify.dev/docs/api/storefront/latest/objects/CompanyLocation#field-CompanyLocation.fields.metafields)
* [Customer.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Customer#field-Customer.fields.metafield)
* [Customer.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Customer#field-Customer.fields.metafields)
* [HasMetafields.metafield](https://shopify.dev/docs/api/storefront/latest/interfaces/HasMetafields#fields-metafield)
* [HasMetafields.metafields](https://shopify.dev/docs/api/storefront/latest/interfaces/HasMetafields#fields-metafields)
* [Location.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Location#field-Location.fields.metafield)
* [Location.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Location#field-Location.fields.metafields)
* [Market.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Market#field-Market.fields.metafield)
* [Market.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Market#field-Market.fields.metafields)
* [Order.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Order#field-Order.fields.metafield)
* [Order.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Order#field-Order.fields.metafields)
* [Page.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Page#field-Page.fields.metafield)
* [Page.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Page#field-Page.fields.metafields)
* [Product.metafield](https://shopify.dev/docs/api/storefront/latest/objects/Product#field-Product.fields.metafield)
* [Product.metafields](https://shopify.dev/docs/api/storefront/latest/objects/Product#field-Product.fields.metafields)
* [ProductVariant.metafield](https://shopify.dev/docs/api/storefront/latest/objects/ProductVariant#field-ProductVariant.fields.metafield)
* [ProductVariant.metafields](https://shopify.dev/docs/api/storefront/latest/objects/ProductVariant#field-ProductVariant.fields.metafields)
* [SellingPlan.metafield](https://shopify.dev/docs/api/storefront/latest/objects/SellingPlan#field-SellingPlan.fields.metafield)
* [SellingPlan.metafields](https://shopify.dev/docs/api/storefront/latest/objects/SellingPlan#field-SellingPlan.fields.metafields)

***

## Mutations

* [cart​Metafields​Set](https://shopify.dev/docs/api/storefront/latest/mutations/cartMetafieldsSet)

  mutation

  Sets [`Metafield`](https://shopify.dev/docs/api/storefront/2026-04/objects/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](https://shopify.dev/docs/apps/build/metafields/use-metafield-capabilities#cart-to-order-copyable) capability enabled.

  ***

  **Note:** This mutation doesn\&#39;t trigger \<a href="https://shopify.dev/docs/api/functions">Shopify Functions\</a>. Changes aren\&#39;t available to Shopify Functions until the buyer goes to checkout or performs another cart interaction that triggers the functions.

  ***

  * metafields

    [\[Cart​Metafields​Set​Input!\]!](https://shopify.dev/docs/api/storefront/latest/input-objects/CartMetafieldsSetInput)

    required

    ### Arguments

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

    The input must not contain more than `250` values.

  ***

***

## Metafield Mutations

### Mutated by

* [cart​Metafields​Set](https://shopify.dev/docs/api/storefront/latest/mutations/cartMetafieldsSet)

***

## Interfaces

* [Node](https://shopify.dev/docs/api/storefront/latest/interfaces/Node)

  interface

***

## Metafield Implements

### Implements

* [Node](https://shopify.dev/docs/api/storefront/latest/interfaces/Node)