Disclosure: one link near the end of this post is an affiliate link. If you sign up through it I may earn a commission at no extra cost to you. Everything else here works with free tools.
Search engines and AI assistants both have to work out, from your HTML, what a product is, what it costs, and whether it is in stock. Structured data (schema.org markup, usually JSON-LD) is the most direct way to state those facts in a machine-readable form. It is not a ranking switch, and nobody can promise that markup alone gets a store into a Google rich result or a ChatGPT answer. What it does is remove ambiguity, and on Shopify it is mostly a matter of checking what the theme already does and filling gaps.
Before writing any Liquid, look at what is on the live page.
application/ld+json.@type you see: Product, Offer / AggregateOffer, Organization, BreadcrumbList, WebSite.
Common findings on real stores:
structured_data filter where you can
Recent Shopify themes (Dawn and most Online Store 2.0 themes based on it) use the built-in Liquid filter:
<script type="application/ld+json">
{{ product | structured_data }}
</script>
Per Shopify's reference, the filter outputs a schema.org Product for a product without variants and a ProductGroup for one with variants. It generates the markup from the product object, so prices, variants, and availability stay in sync with the admin without you maintaining JSON by hand. Check the current behaviour in the Liquid filter reference before relying on it, because Shopify updates what the filter emits. If your theme already uses it, the main job is making sure nothing else on the page duplicates it.
Sometimes you need fields the filter does not cover, such as a GTIN stored in a metafield, or you are on a theme you cannot easily upgrade. Then write the block yourself and let Liquid fill every value. A minimal starting point:
{%- assign current_variant = product.selected_or_first_available_variant -%}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"name": {{ product.title | json }},
"url": {{ request.origin | append: product.url | json }},
{%- if product.featured_image -%}
"image": {{ product.featured_image | image_url: width: 1200 | prepend: 'https:' | json }},
{%- endif -%}
"description": {{ product.description | strip_html | strip_newlines | truncate: 500 | json }},
"brand": { "@type": "Brand", "name": {{ product.vendor | json }} },
{%- if current_variant.sku != blank -%}
"sku": {{ current_variant.sku | json }},
{%- endif -%}
"offers": [
{%- for variant in product.variants -%}
{
"@type": "Offer",
"sku": {{ variant.sku | json }},
"price": {{ variant.price | divided_by: 100.0 | json }},
"priceCurrency": {{ cart.currency.iso_code | json }},
"availability": "https://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}",
"url": {{ request.origin | append: variant.url | json }}
}{% unless forloop.last %},{% endunless %}
{%- endfor -%}
]
}
</script>
Notes on this snippet:
json filter, so quotes and special characters in titles cannot break the JSON.variant.price is in the smallest currency unit, hence divided_by: 100.0. Test with a currency that has no minor unit if you sell in one.cart.currency.iso_code follows the visitor's presentment currency, which matters if you use Shopify Markets.image_url returns a protocol-relative URL, so the snippet adds https:. Check the output in the validator. aggregateRating or review if real reviews are visible on the same page. Marking up ratings that shoppers cannot see is against Google's structured data guidelines.
Product markup answers "what is this item". Two small blocks answer "who sells it":
url, and sameAs links to your real social profiles.
Keep these in one snippet included from theme.liquid so they are not duplicated per section.
Markup is useless if the page is blocked. On Shopify you can customise robots.txt through the robots.txt.liquid template. If you or an app have edited it, open /robots.txt on the live store and check that product and collection paths are not disallowed for the crawlers you care about. Some AI assistants use their own user agents; decide deliberately whether to allow them rather than inheriting a rule from a copied template.
After deploying:
Whether AI assistants actually mention or cite the store is a separate question from whether the markup is valid. You can check it by hand: keep a dated log of the same buyer-style prompts ("best [product type] for [use case]") in ChatGPT, Perplexity, and Gemini and note whether the store appears. If you want a structured snapshot instead, ZeroRank (affiliate link) offers free tools including an AI brand visibility report, and paid plans for scheduled tracking across several assistants. Treat any single result as a snapshot, not a ranking: answers change with phrasing and over time.
/robots.txt does not block product or collection pages