LIQUIDshopifyintermediate
Shopify Product Schema for Google Rich Snippets
Add enhanced Product structured data to Shopify stores for price, availability, and review rich results
Faisal Yaqoob
December 16, 2025
#shopify#product#schema#seo#structured-data#json-ld#rich-snippets#ecommerce#google-shopping
Code
liquid
1 {% comment %} 2 Enhanced Product Schema for Shopify 3 Add to sections/main-product.liquid or snippets/product-schema.liquid 4 {% endcomment %} 5
6 <script type="application/ld+json"> 7 { 8 "@context": "https://schema.org", 9 "@type": "Product", 10 "name": {{ product.title | json }}, 11 "description": {{ product.description | strip_html | truncate: 500 | json }}, 12 "url": "{{ shop.url }}{{ product.url }}", 13 "sku": {{ product.selected_or_first_available_variant.sku | json }}, 14 "mpn": {{ product.selected_or_first_available_variant.barcode | json }}, 15 "brand": { 16 "@type": "Brand", 17 "name": {{ product.vendor | json }} 18 }, 19 "image": [ 20 {% for image in product.images limit: 5 %} 21 "https:{{ image | image_url: width: 1200 }}"{% unless forloop.last %},{% endunless %} 22 {% endfor %} 23 ], 24 "category": {{ product.type | json }}, 25 {% if product.metafields.custom.gtin %} 26 "gtin": {{ product.metafields.custom.gtin | json }}, 27 {% endif %} 28
29 {% if product.variants.size == 1 %} 30 "offers": { 31 "@type": "Offer", 32 "url": "{{ shop.url }}{{ product.url }}", 33 "priceCurrency": {{ cart.currency.iso_code | json }}, 34 "price": {{ product.price | money_without_currency | remove: ',' | json }}, 35 {% if product.compare_at_price > product.price %} 36 "discount": "{{ product.compare_at_price | minus: product.price | money }}", 37 {% endif %} 38 "availability": "https://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}", 39 "seller": { 40 "@type": "Organization", 41 "name": {{ shop.name | json }} 42 }, 43 "shippingDetails": { 44 "@type": "OfferShippingDetails", 45 "shippingDestination": { 46 "@type": "DefinedRegion", 47 "addressCountry": {{ shop.address.country_code | json }} 48 } 49 }, 50 "hasMerchantReturnPolicy": { 51 "@type": "MerchantReturnPolicy", 52 "applicableCountry": {{ shop.address.country_code | json }}, 53 "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow", 54 "merchantReturnDays": 30 55 }, 56 "priceValidUntil": "{{ 'now' | date: '%Y' | plus: 1 }}-12-31", 57 "itemCondition": "https://schema.org/NewCondition" 58 } 59 {% else %} 60 "offers": [ 61 {% for variant in product.variants %} 62 { 63 "@type": "Offer", 64 "url": "{{ shop.url }}{{ variant.url }}", 65 "priceCurrency": {{ cart.currency.iso_code | json }}, 66 "price": {{ variant.price | money_without_currency | remove: ',' | json }}, 67 "availability": "https://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}", 68 "sku": {{ variant.sku | json }}, 69 "name": {{ variant.title | json }}, 70 "itemCondition": "https://schema.org/NewCondition", 71 "priceValidUntil": "{{ 'now' | date: '%Y' | plus: 1 }}-12-31", 72 "seller": { 73 "@type": "Organization", 74 "name": {{ shop.name | json }} 75 } 76 }{% unless forloop.last %},{% endunless %} 77 {% endfor %} 78 ] 79 {% endif %} 80
81 {% if product.metafields.reviews.rating.value != blank %} 82 , 83 "aggregateRating": { 84 "@type": "AggregateRating", 85 "ratingValue": {{ product.metafields.reviews.rating.value.rating | json }}, 86 "ratingCount": {{ product.metafields.reviews.rating_count | json }}, 87 "bestRating": "5", 88 "worstRating": "1" 89 } 90 {% endif %} 91 } 92 </script>
Shopify Product Schema for Google Rich Snippets
Add comprehensive Product structured data to your Shopify store that enables price, availability, review stars, and shipping rich results in Google Search. This goes beyond Shopify's default schema with additional properties that Google rewards.
Enhanced Product Schema
{% comment %}
Enhanced Product Schema for Shopify
Add to sections/main-product.liquid or snippets/product-schema.liquid
{% endcomment %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"name": {{ product.title | json }},
"description": {{ product.description | strip_html | truncate: 500 | json }},
"url": "{{ shop.url }}{{ product.url }}",
"sku": {{ product.selected_or_first_available_variant.sku | json }},
"mpn": {{ product.selected_or_first_available_variant.barcode | json }},
"brand": {
"@type": "Brand",
"name": {{ product.vendor | json }}
},
"image": [
{% for image in product.images limit: 5 %}
"https:{{ image | image_url: width: 1200 }}"{% unless forloop.last %},{% endunless %}
{% endfor %}
],
"category": {{ product.type | json }},
{% if product.metafields.custom.gtin %}
"gtin": {{ product.metafields.custom.gtin | json }},
{% endif %}
{% if product.variants.size == 1 %}
"offers": {
"@type": "Offer",
"url": "{{ shop.url }}{{ product.url }}",
"priceCurrency": {{ cart.currency.iso_code | json }},
"price": {{ product.price | money_without_currency | remove: ',' | json }},
{% if product.compare_at_price > product.price %}
"discount": "{{ product.compare_at_price | minus: product.price | money }}",
{% endif %}
"availability": "https://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}",
"seller": {
"@type": "Organization",
"name": {{ shop.name | json }}
},
"shippingDetails": {
"@type": "OfferShippingDetails",
"shippingDestination": {
"@type": "DefinedRegion",
"addressCountry": {{ shop.address.country_code | json }}
}
},
"hasMerchantReturnPolicy": {
"@type": "MerchantReturnPolicy",
"applicableCountry": {{ shop.address.country_code | json }},
"returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",
"merchantReturnDays": 30
},
"priceValidUntil": "{{ 'now' | date: '%Y' | plus: 1 }}-12-31",
"itemCondition": "https://schema.org/NewCondition"
}
{% else %}
"offers": [
{% for variant in product.variants %}
{
"@type": "Offer",
"url": "{{ shop.url }}{{ variant.url }}",
"priceCurrency": {{ cart.currency.iso_code | json }},
"price": {{ variant.price | money_without_currency | remove: ',' | json }},
"availability": "https://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}",
"sku": {{ variant.sku | json }},
"name": {{ variant.title | json }},
"itemCondition": "https://schema.org/NewCondition",
"priceValidUntil": "{{ 'now' | date: '%Y' | plus: 1 }}-12-31",
"seller": {
"@type": "Organization",
"name": {{ shop.name | json }}
}
}{% unless forloop.last %},{% endunless %}
{% endfor %}
]
{% endif %}
{% if product.metafields.reviews.rating.value != blank %}
,
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": {{ product.metafields.reviews.rating.value.rating | json }},
"ratingCount": {{ product.metafields.reviews.rating_count | json }},
"bestRating": "5",
"worstRating": "1"
}
{% endif %}
}
</script>
Collection Page Schema (Category)
{% comment %}
CollectionPage Schema for Shopify collection pages
Add to sections/main-collection.liquid
{% endcomment %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "CollectionPage",
"name": {{ collection.title | json }},
"description": {{ collection.description | strip_html | truncate: 300 | json }},
"url": "{{ shop.url }}{{ collection.url }}",
"numberOfItems": {{ collection.products_count }},
"mainEntity": {
"@type": "ItemList",
"numberOfItems": {{ collection.products_count }},
"itemListElement": [
{% for product in collection.products limit: 10 %}
{
"@type": "ListItem",
"position": {{ forloop.index }},
"url": "{{ shop.url }}{{ product.url }}",
"name": {{ product.title | json }},
"image": "https:{{ product.featured_image | image_url: width: 800 }}"
}{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}
}
</script>
Shopify Store Organization Schema
{% comment %}
Organization Schema - Add to layout/theme.liquid before </head>
{% endcomment %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"name": {{ shop.name | json }},
"url": "{{ shop.url }}",
"logo": {
"@type": "ImageObject",
"url": "https:{{ 'logo.png' | asset_url }}"
},
"description": {{ shop.description | json }},
"address": {
"@type": "PostalAddress",
"streetAddress": {{ shop.address.street | json }},
"addressLocality": {{ shop.address.city | json }},
"addressRegion": {{ shop.address.province | json }},
"postalCode": {{ shop.address.zip | json }},
"addressCountry": {{ shop.address.country_code | json }}
},
{% if shop.phone %}
"telephone": {{ shop.phone | json }},
{% endif %}
{% if shop.email %}
"email": {{ shop.email | json }},
{% endif %}
"sameAs": [
{{ settings.social_facebook_link | json }},
{{ settings.social_instagram_link | json }},
{{ settings.social_twitter_link | json }}
]
}
</script>
WebSite Schema with Search
{% comment %}
WebSite Schema with SearchAction - Add to layout/theme.liquid
{% endcomment %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": {{ shop.name | json }},
"url": "{{ shop.url }}",
"potentialAction": {
"@type": "SearchAction",
"target": "{{ shop.url }}/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
Best Practices
- Include all variants as separate Offer objects for multi-variant products
- Add
priceValidUntil— required by Google for Product rich results - Include
shippingDetailsandreturnPolicyfor Google Shopping eligibility - Use Shopify metafields for GTIN/UPC barcodes and review data
- Limit collection items to 10-20 products in ItemList schema
- Test every product template with Google Rich Results Test
- Keep
imagearray — multiple product images improve rich result appearance
Features
- Google Shopping Ready: Includes shipping and return policy for Merchant Center
- Multi-Variant Support: Each variant gets its own Offer with price and availability
- Review Stars: Integrates with Shopify product reviews metafields
- Collection Pages: ItemList schema for category pages
- Search Action: Enables Google Sitelinks Search Box
- Dynamic Pricing: Pulls live prices from Shopify data
Related Snippets
Shopify Product Recommendations
Display related products using Shopify's built-in recommendation engine
LIQUIDshopifybeginner
liquidPreview
{% comment %}
Product Recommendations Section
Add this to your product template or create as a section
{% endcomment %}
...#shopify#liquid#recommendations+2
1/9/2025
View
Shopify Variant Selector with Images
Dynamic variant selector that updates product images and price in real-time
LIQUIDshopifyintermediate
liquidPreview
{% comment %}
Product Variant Selector
Add this to your product template
{% endcomment %}
...#shopify#liquid#variants+2
1/9/2025
View
Next.js 15 Structured Data and Rich Results
Implement dynamic JSON-LD structured data in Next.js 15 App Router with Server Components and Metadata API
TYPESCRIPTseoadvanced
typescriptPreview
// components/JsonLd.tsx
// Reusable, type-safe JSON-LD component for any schema type
import type { Thing, WithContext } from 'schema-dts';
...#nextjs#react#schema+7
1/10/2026
View