Edit Theme File
Important :
It is recommend you remove all your old structured data coding.
Edit Theme by going to Storefront > My Themes > Inside the current theme, click on Advanced > Edit Theme Files
Navigate to : templates/components/products/product-view.html
Paste the below JSON-LD or Microdata at the top of the page and save.
<!-- Copyright FeedArmy 2023 Version 1.20 -->
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"@id": "{{ product.url }}",
"name": "{{product.title}}",
"sku": "{{ product.id }}",
{{#if product.gtin }}"gtin": "{{ product.gtin }}", {{/if}}
{{#if product.brand.name }}"brand": {
"@type": "Brand",
"name": "{{product.brand.name}}",
},{{/if}}
"description": "{{ sanitize product.description }}",
"image": "{{getImage product.main_image "thumbnail"}}",
"url": "{{product.url}}",
"offers": {
"@type": "Offer",
"priceCurrency": "{{currency_selector.active_currency_code}}",
"price": "{{ product.price.with_tax.value }}",
"itemCondition" : "http://schema.org/NewCondition",
"availability" : "{{#if product.out_of_stock}}http://schema.org/OutOfStock{{else}}http://schema.org/InStock{{/if}}",
"url" : "{{product.url}}"
}
}
</script>
Testing
Verify that you have done it correctly by checking the page with Google’s Structured Data Testing Tool
As of writing, you will see 3 warnings, these are :
- priceValidUntil
- aggregateRating
- review
Shopify has no default coding that can be used to fill these fields in. So simply ignore these.