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. A working guide for Shopify developers and senior SEO leads.

eCommerce Insights Team · 2026-04-18 · 10 min read


Shopify metafields are the most powerful, least-used feature for AI search on Shopify stores. They are where a brand encodes the structured facts about a product that don't fit into the title or description — GTIN, brand, material, country of origin, fit notes, compatibility. When those facts are present and wired into Product JSON-LD, AI engines can identify the SKU cleanly, compare it against alternatives, and surface it on the relevant query. When the fields are absent, the engine guesses, and the guess often lands on a competitor. This post walks through the metafields that matter for AI search, how to structure them, and the code that connects them to the PDP.

Which metafields matter

Shopify's built-in product fields cover title, description, price, variants, images, and collections. AI engines need more than that to disambiguate. The metafields that matter most in Q1 2026, roughly in order, are:

  • gtin — Global Trade Item Number. The single most important identifier for cross-referencing your SKU with marketplaces, Merchant Center, and review sites.
  • brand — your brand name, as you want it written. eCommerce Insights frequently sees brand values inconsistent across the catalog, which confuses retrieval.
  • material — primary material or composition. "100% merino wool" or "recycled polyester blend" beats a vague description.
  • pattern — solid, striped, floral, plaid. Relevant for soft goods; trivial elsewhere.
  • country_of_origin — matters for buyers who filter on origin and for Merchant Center feeds.
  • color — variant-level, ideally. The color name buyers use, not your SKU code.
  • gender — men's, women's, unisex. Mandatory for apparel Merchant Center feeds.
  • age_group — adult, kids, infant. Same reasoning.
  • size — variant-level, usually a size chart reference.

Beyond this core set, category-specific fields help. Electronics benefits from compatibility, connectivity, and power. Kitchen benefits from dishwasher_safe, oven_safe, capacity. The general 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 the mm-google-shopping namespace for fields that map directly to Merchant Center; use custom or a brand-specific namespace for everything else. Set the type correctly (single-line text for most strings, number_decimal for numeric, measurement for weights and dimensions). Enable "Appears on Storefront API" so your theme can read the field without extra permissions.

When defining the field, include validation rules where sensible. A GTIN field should validate as 12–14 digits. A country_of_origin field should validate against ISO 3166 codes. Validation catches the bulk-edit mistakes that create silent schema bugs.

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

How metafields feed Product JSON-LD

The metafield's value has to reach your rendered PDP for AI engines to consume it. Most Shopify themes ship with a skeleton Product JSON-LD block in their Liquid templates. The useful work is replacing hardcoded fields with metafield references. Below is a Liquid snippet that pulls several metafields into a Product JSON-LD block. This is an illustrative pattern, not a copy-paste template — adapt to your theme's structure.

<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 explicit selected_or_first_available_variant calls for variant-level fields. This is how the JSON-LD reflects the variant the shopper is actually looking at, which matters because AI engines often retrieve a specific PDP URL with a variant already selected in the query string.

How metafields feed llms.txt

llms.txt is a proposed plain-text file served at your site root. It gives AI crawlers a curated summary of the site — product names, key attributes, canonical URLs. Metafields are the ideal source of the attributes you include. A well-populated brand metafield, for example, flows into every product listing in your llms.txt as "Brand: [your brand]" without you editing 500 product entries by hand.

eCommerce Insights's llms.txt generator reads Shopify metafields directly so you can see what a metafield-fed llms.txt would look like on your store. For the broader context on the file itself, see llms.txt for Shopify.

Metafields most Shopify PDPs leave empty in Q1 2026

From eCommerce Insights's internal audits during Q1 2026, the most commonly missing metafields — on otherwise-well-run Shopify catalogs — were GTIN, material, country_of_origin, and variant-level color. GTIN is the most expensive to miss, because it's the field every marketplace, review site, and AI engine uses to resolve a product across sources. Material is second-most expensive because it's how buyers describe products in natural language. Variant-level color bugs are the quickest to fix but the most visible — a shopper filtering on "navy" gets nothing when your color metafield lives at the product level with "Multiple" as its value.

Variant-level metafields

Variants deserve their own metafields for any field that genuinely differs between variants. The medium and large of the same base layer have different dimensions, different weights, potentially different material if one is a long-sleeve variant. Store each at the variant level and your JSON-LD can adapt per variant. Product-level metafields should hold things that don't change across variants: brand, country of origin, care instructions, base material family. Mixing the levels is where most Shopify PDPs accumulate silent schema bugs.

Shopify's own metafield documentation covers the admin and API details if you need to go deeper. The SEO dimension — which fields matter most for AI — is covered in eCommerce Insights's schema guide.

Where to start this week

Open Shopify admin. Go to Settings → Custom data → Products. List the metafields defined on your store. Mark the core set — GTIN, brand, material, country_of_origin, color, pattern, gender, age_group — as either present or missing. For each missing field, define it with the correct type and validation. Then pick your top ten revenue SKUs and populate the fields manually, using buyer-recognizable language. Push to the theme's Product JSON-LD. Re-run your PDP through Google's Rich Results Test to verify. That's a realistic one-week project for a solo developer and it improves visibility on every engine.

Key takeaways

  • Shopify metafields are how brands encode structured product facts beyond title and description. They're AI search's backbone.
  • The core set is GTIN, brand, material, pattern, country_of_origin, color, gender, age_group. Category-specific fields extend this.
  • Define fields once in admin with validation. Populate them at the right scope — product or variant — and wire them into Product JSON-LD.
  • Most Shopify PDPs in Q1 2026 leave GTIN, material, and variant-level color blank. Those are the highest-return fixes.
  • The same metafields that feed JSON-LD can feed llms.txt. eCommerce Insights's generator reads them directly.

Ask AI about Shopify metafields for AI search

Have your favorite AI engine summarize this for your specific use case.

Frequently asked questions

Which Shopify metafields matter for AI visibility?
The fields that map directly 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 metafields matter when your variants should rank independently. Beyond those, any field that feeds your Product JSON-LD is useful.
Do metafields on their own affect AI search, or only via JSON-LD?
Primarily via JSON-LD and the rendered PDP. Metafields are storage; their SEO and AI visibility effect comes from how your theme and schema apps surface them. A clean metafield with no schema wiring is invisible. 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 any field that differs between variants — color, pattern, size, GTIN. Product-level for fields shared across all variants — brand, material family, country of origin. Mixing levels is the source of most PDP schema bugs eCommerce Insights sees in Q1 2026. Match the metafield level to the property's natural scope.
Are metafield definitions the same as metafield values?
No. A metafield definition is the schema — namespace, key, type, validation rules — set once per store. A metafield value is the actual data on a product or variant. Shopify enforces the definition once it exists, which is why defining fields before bulk editing is worth the minor upfront effort.

See every metafield gap on your catalog.

eCommerce Insights scans your Shopify admin, audits every SKU's metafields and JSON-LD, and tells you which fixes move the visibility score most.