Skip to main content
Shopify guide

JSON-LD for Shopify Stores

By ยท Updated ยท 7 min read

How JSON-LD Works on Shopify Stores

Shopify renders structured data through Liquid templates โ€” the platform's proprietary templating language. Unlike WordPress, where plugins inject JSON-LD directly into the <head> or before </body>, Shopify requires that JSON-LD blocks be placed inside Liquid template files such as product.liquid, collection.liquid, or article.liquid. Shopify's Online Store 2.0 architecture uses JSON template files (e.g., product.json) rather than Liquid files for layout assembly, which changes where and how structured data is injected.

Shopify's hosted infrastructure means merchants cannot edit server-side logic or PHP files, so all JSON-LD must be client-rendered or injected through Liquid. This is an important distinction: some SEO tools designed for other platforms assume server-side access that Shopify does not provide. JSON-LD injected via Liquid is still crawlable by Googlebot, which renders JavaScript, but the cleanest implementation keeps structured data in Liquid templates rather than in external JavaScript files loaded asynchronously.

What Shopify Themes Include by Default

Shopify's official themes โ€” Dawn, Craft, Crave, and others in the Theme Store โ€” include basic JSON-LD out of the box. Dawn, Shopify's reference theme for Online Store 2.0, outputs a Product schema block that includes name, description, image, offers (price, availability, URL), and SKU. It does not include AggregateRating, Review, or BreadcrumbList schema by default. Breadcrumbs are rendered as visible HTML elements but rarely accompanied by structured data markup.

Third-party themes vary widely. Many premium themes from developers like Pixel Union or Clean Canvas include schema, but the quality differs โ€” some use outdated schema.org types, omit required fields like priceCurrency, or duplicate structured data across multiple script blocks, which triggers Google Search Console warnings. Before adding any app or custom code, audit the theme's existing output using Google's Rich Results Test to avoid conflicting JSON-LD blocks.

The Shopify metafields system (expanded significantly in 2021 and refined in 2022) allows merchants to store structured product attributes, but these metafields do not automatically appear in JSON-LD output. Pulling metafield values into JSON-LD requires either custom Liquid code or an app that maps metafield namespaces to schema.org properties.

Apps That Add or Enhance JSON-LD on Shopify

The Shopify App Store contains several apps focused on structured data. JSON-LD for SEO by Ilana Davis is one of the most widely used โ€” it injects Product, BreadcrumbList, Organization, WebSite, and review schema automatically and is designed specifically around Shopify's Liquid constraints. Schema Plus for SEO and Smart SEO are two other commonly installed options. Each app uses a Liquid snippet injected via the theme's layout file (theme.liquid) so the JSON-LD appears on every relevant page type.

Review apps introduce an important dependency: AggregateRating schema requires a data source. If a store uses Shopify's native product reviews app (now deprecated in favor of Shopify Product Reviews successor integrations), a dedicated schema app must be configured to read from whichever review platform โ€” Judge.me, Stamped.io, Okendo, Yotpo โ€” the store uses. Without correct pairing, the AggregateRating block either outputs zero reviews or gets flagged in Google Search Console for missing required fields.

Shopify's App Blocks feature (available in Online Store 2.0 themes) allows some apps to inject JSON-LD through the theme editor rather than direct theme file edits. This is safer for merchants who lack Liquid experience, but it does create a dependency: if the app is uninstalled, the structured data disappears immediately from all pages. Document which apps are responsible for which schema types before making any app changes.

Shopify-Specific Limitations and Common Errors

Shopify's variant system creates a structural challenge for Product schema. A single Shopify product can have up to 100 variants, each with its own price and availability. The schema.org Product type supports an offers array, so multiple Offer objects can represent each variant. However, most default theme implementations output only the first variant's price, which means Google sees a product as unavailable or mispriced if the default variant is out of stock while others are in stock.

Canonical URL mismatches are another frequent issue. Shopify generates two URLs for products that appear in collections: the canonical URL (e.g., /products/product-handle) and the collection-scoped URL (e.g., /collections/collection-handle/products/product-handle). If JSON-LD uses the collection-scoped URL in the url or offers.url fields, it conflicts with the canonical tag, which can confuse crawlers. JSON-LD on Shopify should always reference the canonical /products/ URL.

Shopify's CDN caches rendered pages aggressively. After updating JSON-LD in a Liquid template, changes may not be visible to crawlers for several hours. Use the URL Inspection tool in Google Search Console to force a re-fetch rather than assuming immediate propagation.

Custom JSON-LD Implementation in Shopify Liquid

For stores that prefer direct control over an app dependency, adding JSON-LD manually to Shopify Liquid is straightforward. Create a new snippet file (e.g., snippets/json-ld-product.liquid), write the JSON-LD block using Liquid variables like {{ product.title | json }}, {{ product.price | money_without_currency }}, and {{ product.selected_or_first_available_variant.available }}, then render the snippet inside product.liquid or the equivalent JSON template section. Wrapping output values with Liquid's | json filter handles character escaping and prevents malformed JSON from breaking the script block.

For stores on Online Store 2.0, structured data snippets belong in the theme's Liquid section files rather than in a standalone template. The correct pattern is to create a section file (e.g., sections/product-json-ld.liquid) and include it in the product JSON template file under the sections key. This keeps structured data modular, version-controllable via the Shopify CLI and GitHub integration, and separate from layout concerns.

Actionable Priorities for Shopify Structured Data

Start with a rich results audit: run the store's product, collection, article, and homepage URLs through Google's Rich Results Test. Identify which schema types are already present and which required fields are missing. Product and BreadcrumbList are the highest-priority types for most Shopify stores because they directly affect Shopping tab eligibility and breadcrumb display in search results.

Resolve the variant pricing issue before anything else โ€” ensure the offers array reflects actual current availability across all variants, not just the default. Then add AggregateRating only if the review count is substantial enough to display without negative impact; a 2.8-star average from three reviews will reduce click-through rates even if it earns rich snippet display. Finally, set up Google Search Console monitoring on the Enhancements tab so errors in structured data surface within days rather than weeks.

Frequently asked questions

Does Shopify automatically add JSON-LD to product pages?

Official Shopify themes like Dawn include basic Product schema by default, covering name, price, availability, and image. However, they omit AggregateRating, BreadcrumbList, and full variant-level pricing. Third-party themes vary in quality. Every store should audit its existing structured data output with Google's Rich Results Test before assuming default schema is complete or error-free.

Can Shopify's Liquid templating handle complex JSON-LD structures?

Yes. Liquid supports loops, conditionals, and filters like | json that handle escaping, making it capable of producing complex JSON-LD with variant-level offers arrays, multiple images, and conditional availability status. The main constraint is that Shopify's Liquid runs server-side at render time, so dynamic updates (e.g., real-time inventory changes) require either page re-renders or JavaScript-based JSON-LD injection, which adds complexity.

What happens to JSON-LD if a schema app is uninstalled from Shopify?

If the app injects JSON-LD via a Liquid snippet rendered through theme.liquid, uninstalling the app removes the snippet render call and the structured data disappears from all pages immediately. Google will stop seeing those schema types on the next crawl. Before uninstalling any structured data app, confirm whether a replacement implementation is in place, then monitor Google Search Console for drops in rich result eligibility.

How should Shopify stores handle JSON-LD for product variants?

Use the schema.org offers array to include one Offer object per variant, each with its own price, priceCurrency, availability, and SKU. In Liquid, loop through product.variants to generate each Offer block. Avoid outputting only the default variant's data โ€” if that variant is sold out while others are available, Google sees the product as unavailable and excludes it from Shopping-eligible results.

Is it better to use a Shopify app or custom Liquid code for JSON-LD?

Apps are faster to deploy and stay updated as schema.org requirements evolve, but they create a dependency and add monthly cost. Custom Liquid code gives full control, works without ongoing fees, and integrates cleanly with version control via Shopify CLI. Stores with developer resources and complex product data โ€” multiple variants, metafields, custom attributes โ€” benefit from custom implementation. Smaller stores without Liquid experience are better served by a well-maintained app.

MG
Written by

Matt is the founder of RunOctopus. He built All Angles Creatures from zero to page-1 rankings in reptile feeder insects in under 60 days using exactly this method โ€” turning a hard, entrenched niche into RunOctopus's proof store for programmatic SEO and AI search citation.

Connect on LinkedIn →

See what Otto would build for your store

Free architecture preview. No card required. Five minutes.

Generate Preview →