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.

1. Find out what your theme already outputs

Before writing any Liquid, look at what is on the live page.

  1. Open a product page, view source, and search for application/ld+json.
  2. Paste the product URL into Google's Rich Results Test and the Schema Markup Validator.
  3. Note every @type you see: Product, Offer / AggregateOffer, Organization, BreadcrumbList, WebSite.

Common findings on real stores:

  • Two Product blocks. The theme outputs one, and a reviews or SEO app adds another with different prices or a different name. Pick one source and remove the other.
  • Only the first variant. The offer shows one price and one availability even though the product has many variants.
  • Hard-coded currency or stale availability, usually from a snippet copied years ago.
  • Nothing at all, typical of older or heavily customised themes.

2. Use Shopify's 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.

3. If you need custom JSON-LD, build it from Liquid objects

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:

  • Every string goes through the 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.
  • Only add 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.

4. Do not forget the store-level markup

Product markup answers "what is this item". Two small blocks answer "who sells it":

  • Organization on the home page: name, logo, url, and sameAs links to your real social profiles.
  • BreadcrumbList on product and collection pages, matching the breadcrumb the shopper actually sees.

Keep these in one snippet included from theme.liquid so they are not duplicated per section.

5. Make sure crawlers can reach the pages at all

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.

6. Verify, then keep checking

After deploying:

  1. Re-run the Rich Results Test and Schema Markup Validator on a simple product, a product with many variants, and a sold-out product.
  2. Watch the Merchant listings and Product snippets reports in Google Search Console for new errors over the following weeks.
  3. Re-test after theme updates and after installing any review, SEO, or bundle app, since those are the usual sources of duplicate blocks.

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.

Quick checklist

  • [ ] One Product JSON-LD block per product page, not two
  • [ ] All variants represented, with correct price, currency, and availability
  • [ ] No ratings in markup unless the reviews are visible on the page
  • [ ] Organization and BreadcrumbList present once
  • [ ] /robots.txt does not block product or collection pages
  • [ ] Validated on simple, multi-variant, and sold-out products
  • [ ] Re-checked after every theme or app change