Blog · Technical

Shopify metafields for AI search.

Which metafields matter, how to structure them, and how they flow into Product JSON-LD and llms.txt. For Shopify developers and senior SEO leads.

eCommerce Insights research team · · Updated · 9 min read


Metafields are the most consequential, least-used AI search feature on Shopify stores. They are where a brand encodes the structured facts that do not fit the title or description — GTIN, brand, material, country of origin, fit notes, compatibility. When those facts are present and wired into Product JSON-LD, an AI engine can identify the SKU cleanly, compare it against alternatives, and cite it on the right query. When they are absent, the engine guesses, and the guess often lands on a competitor.

Which metafields matter

Shopify's built-in product fields cover title, description, price, variants, images, and collections. Engines need more to disambiguate. The core set, roughly in order of return:

MetafieldWhy it earns the citation
gtinThe identifier marketplaces, Merchant Center, review sites, and AI engines use to resolve one product across sources
brandInconsistent brand values across a catalog confuse retrieval — write it once, the way you want it cited
material"100% merino wool" is how buyers describe products in natural language; engines match on it
colorVariant-level, in the buyer's word for it — "navy," not your internal SKU code
country_of_originBuyers filter on it; Merchant Center feeds want it
pattern / gender / age_groupMandatory for apparel feeds; cheap disambiguation everywhere else

Beyond the core set, category-specific fields earn their keep: compatibility, connectivity, and power for electronics; dishwasher_safe, oven_safe, capacity for kitchen. The rule:

If a buyer might filter on it or ask an AI engine about it, it belongs in a metafield.

How to structure them

Define fields in Shopify admin under Settings → Custom data → Products. Each field gets a namespace and a key: use mm-google-shopping for fields that map straight to Merchant Center, custom or a brand namespace for the rest. Set types correctly — single-line text for strings, number_decimal for numerics, measurement for weights and dimensions — and enable Storefront API exposure so the theme can read the field.

Add validation rules at definition time. A GTIN field should validate as 12–14 digits; country_of_origin should validate against ISO 3166. Validation is what catches the bulk-edit mistakes that otherwise become silent schema bugs.

Wiring metafields into Product JSON-LD

A metafield's value has to reach the rendered PDP before any engine can consume it. Most themes ship a skeleton Product JSON-LD block in Liquid; the useful work is replacing hardcoded values with metafield references. An illustrative pattern — adapt to your theme:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "{{ product.title | escape }}",
  "sku": "{{ product.selected_or_first_available_variant.sku }}",
  "gtin13": "{{ product.metafields.custom.gtin }}",
  "brand": { "@type": "Brand",
    "name": "{{ product.metafields.custom.brand | default: shop.name }}" },
  "description": "{{ product.description | strip_html | escape }}",
  "image": "{{ product.featured_image | image_url: width: 1200 }}",
  "material": "{{ product.metafields.custom.material }}",
  "color": "{{ product.selected_or_first_available_variant.metafields.custom.color }}",
  "countryOfOrigin": "{{ product.metafields.custom.country_of_origin }}",
  "offers": { "@type": "Offer",
    "url": "{{ shop.url }}{{ product.url }}",
    "priceCurrency": "{{ cart.currency.iso_code }}",
    "price": "{{ product.selected_or_first_available_variant.price | money_without_currency }}",
    "availability": "{% if product.available %}https://schema.org/InStock{% else %}https://schema.org/OutOfStock{% endif %}" }
}
</script>

Note the selected_or_first_available_variant calls for variant-level fields. That is how the JSON-LD reflects the variant the shopper — or the shopping agent — is actually looking at, which matters because engines often retrieve a PDP URL with a variant pre-selected in the query string. Complete, variant-accurate offers data is also the largest single input to the agent-readability score: a draft-cart agent cannot add a product whose price and availability it cannot parse.

Metafields feed llms.txt too

llms.txt is a plain-text file served at the site root that gives AI crawlers a curated summary — product names, key attributes, canonical URLs. Metafields are the natural source of those attributes: a populated brand metafield flows into every product line of the file without anyone editing 500 entries by hand. The free llms.txt generator reads Shopify metafields directly; the llms.txt for Shopify guide covers the file itself, and the glossary entry has the short version.

The fields most stores leave empty

From the research team's 2026 audits, the most commonly missing metafields on otherwise well-run catalogs: GTIN, material, country_of_origin, and variant-level color. GTIN is the most expensive miss — it is the field every other source uses to resolve your product. Material is second, because it is how buyers talk. Variant-level color bugs are the quickest fix and the most visible: a shopper filtering "navy" gets nothing when color lives at the product level with "Multiple" as its value.

Variant-level vs product-level

Variants deserve their own metafields for anything that genuinely differs between them — the medium and the large have different dimensions, weights, sometimes materials. Product-level metafields hold what does not change: brand, material family, care instructions, origin. Mixing the levels is where most Shopify catalogs accumulate silent schema bugs. Shopify's own metafield documentation covers the admin and API mechanics; the SEO dimension lives in the schema for AI search guide.

Where to start this week

Open Settings → Custom data → Products and list what is defined. Mark the core set — GTIN, brand, material, country_of_origin, color, pattern, gender, age_group — present or missing. Define the missing ones with correct types and validation. Populate your top ten revenue SKUs by hand, in buyer language. Wire the theme's JSON-LD. Verify with Google's Rich Results Test. That is a realistic one-week project for a solo developer, and it improves grounding on every engine at once. eCommerce Insights automates the audit half: it reads the catalog through the admin API and flags exactly which fields are missing on which SKUs, with the diff attached.

Key takeaways

  • Metafields are where structured product facts live; they are the backbone of SKU-level AEO on Shopify.
  • Core set: GTIN, brand, material, pattern, country_of_origin, color, gender, age_group. Category fields extend it.
  • Define once with validation, populate at the right scope, wire into Product JSON-LD.
  • Most 2026 catalogs leave GTIN, material, and variant-level color blank — the highest-return fills.
  • The same metafields feed JSON-LD, llms.txt, and the agent-readability score. One source, three surfaces.

Ask AI about Shopify metafields for AI search

Have your preferred AI engine summarize the setup for your store.

Frequently asked questions

Which Shopify metafields matter for AI visibility?
The fields that map to schema.org/Product properties. GTIN, brand, material, pattern, color, country_of_origin, gender, and age_group are the ones AI engines use to disambiguate a SKU and characterize it accurately. Variant-level color and size matter when variants should surface independently. Beyond those, any field that feeds your Product JSON-LD is useful.
Do metafields affect AI search on their own, or only via JSON-LD?
Primarily via JSON-LD and the rendered PDP. Metafields are storage; the visibility effect comes from how your theme and schema wiring surface them. A clean metafield with no schema wiring is invisible to engines. The payoff appears when metafields flow into Product JSON-LD, visible PDP copy, or an llms.txt summary.
Should metafields be product-level or variant-level?
Variant-level for anything that differs between variants — color, size, GTIN, pattern. Product-level for fields shared across variants — brand, material family, country of origin. Mixing the levels is the source of most silent PDP schema bugs eCommerce Insights sees in 2026 audits. Match the metafield level to the property's natural scope.
Are metafield definitions the same as metafield values?
No. A definition is the schema — namespace, key, type, validation rules — set once per store under Settings, Custom data. A value is the actual data on a product or variant. Shopify enforces the definition once it exists, which is why defining fields with validation before bulk editing is worth the upfront effort.

See every metafield gap on your catalog.

eCommerce Insights reads your Shopify admin, audits every SKU's metafields and JSON-LD, and ranks the fixes by visibility return.