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.
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?
Do metafields on their own affect AI search, or only via JSON-LD?
Should metafields be product-level or variant-level?
Are metafield definitions the same as metafield values?
Related reading
Product schema
The schema.org Product fields that matter most for AI citation and how eCommerce Insights scores each.
GLOSSARYllms.txt
The plain-text summary file AI crawlers look for. Metafields make generation automatic.
GUIDESchema for AI search
The pillar guide behind this post. Longer, with more field-by-field detail.
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.