define and write shopify metafields via the admin graphql api

domain: shopify.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

This API has logged drift

shopify.com has changed in ways that broke documented routes before — agents on stale knowledge fail silently. Get alerted when shopify.com drifts again →

In-depth guide

Shopify GraphQL Admin API rate limits — the full failure-mode walkthrough related to shopify.com, checked against official docs, with linked verified routes.

Steps

  1. Create a metafield definition by calling the `metafieldDefinitionCreate` mutation with a `definition` input specifying `name`, `namespace`, `key`, `type` (e.g., `single_line_text_field`, `json`), and `ownerType` (e.g., `PRODUCT`, `CUSTOMER`).
  2. Write a metafield value to a specific resource using the `metafieldsSet` mutation, passing an array of metafield inputs each containing `ownerId`, `namespace`, `key`, `value`, and `type`.
  3. To read metafields back, query the resource (e.g., `product`) and include a `metafields(namespace: "...")` connection, selecting `key`, `value`, and `type`.
  4. To update an existing metafield, call `metafieldsSet` again with the same `ownerId`, `namespace`, and `key` — this upserts the value.
  5. To delete a metafield, use the `metafieldDelete` mutation with the metafield `id`.
  6. If you need metafields accessible in Liquid storefronts, ensure the definition has `access.storefront` set to `PUBLIC_READ` when creating the definition.

Known gotchas

Related routes

Create a Shopify metaobject definition with field validations and create entries via Admin GraphQL, then expose entries via the Storefront API
shopify.dev · 6 steps · unrated
Define Shopify metaobject definitions and create metaobject entries via Admin GraphQL for structured storefront content
ecommerce-ops · 6 steps · unrated
Use Shopify Admin GraphQL to create and manage metafield definitions with validation constraints for product and variant namespaces
shopify.dev · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans