Shopify Product Schema Generator

Generate a dynamic Product schema snippet for your Shopify theme. Instead of static values, it outputs Liquid that fills in each product’s title, description, price, variants and ratings automatically — one snippet covers your whole catalog.

Details

Advanced & recommended fields

Liquid code for your theme

Dynamic Shopify product schema, done right

Most schema tools output static JSON-LD for a single product. That doesn't scale on Shopify, where one main-product template renders thousands of products. This Shopify product schema generator instead builds a Liquid snippet: you paste it once, and Shopify fills in {{ product.title }}, the description, price, availability, variants and star ratings live for every product page.

How to add it to your theme

  1. Pick your pricing model and fill in your rating fields on the left. The Liquid updates instantly on the right.
  2. Copy the snippet and go to Online Store → Themes → Edit code.
  3. Open layout/theme.liquid and paste the snippet just before the closing </head> tag. This works on every theme — including newer ones like Horizon that no longer ship a sections/main-product.liquid file. Because the snippet is wrapped in {% if template.name == 'product' %}, it only outputs on product pages even though it lives in the site-wide layout.
  4. Save, then open a live product URL and test it in Google's Rich Results Test.

What the Liquid does

  • Values are escaped safely with Shopify's | json filter, so quotes and special characters never break your JSON-LD.
  • Variants can be emitted as one Offer per variant, a single Offer, or a AggregateOffer price range — whichever suits your products.
  • Availability switches between InStock and OutOfStock per variant automatically.
  • Product-page only — the whole block is wrapped in {% if template.name == 'product' %}, so it never fires on collection, cart or home pages.

Adding star ratings from your reviews app

Shopify has no built-in review system, so you supply the average rating and review count as Liquid expressions — normally the metafields your reviews app exposes. The fields are prefilled with Shopify's native product.metafields.reviews.rating metafields; replace them with your app's (for example a Judge.me, Loox or Yotpo metafield). The generator wraps the aggregateRating in {% if <review count> > 0 %} so it only ever renders when there are genuine reviews — never fabricated. Leave both fields blank to omit ratings entirely.

Avoiding duplicate markup

Because many Shopify themes already output some Product markup, paste a live product page's HTML into our schema validator first so you don't ship duplicate blocks. For the wider setup, see our Shopify schema markup guide, the standard Product schema generator, and how AggregateRating schema earns star results.

More schema tools