Created on 7 May, 2015 | Updated on 13 September, 2021
Adding Structured Data to Shopify for Google Merchant (JSON-LD)

Adding Structured Data to Shopify for Google Merchant & Facebook (JSON-LD)

If you have received errors or warnings regarding missing or invalid data for prices, condition, availability, etc… Then the code below will solve this issue. You will need to both updates Opengraph and JSON-LD. Copy the JSON-LD code and paste it inside your product.liquid file using the latest JSON-LD technology. And replace two lines in your social-meta-tag file. This code supports variants by keeping the first selected product as the first iteration. If you have multiple variants such as colors and the second color is preselected based on the URL. This is done to follow the Google Merchant Center guidelines and while keeping SEO integrity.

This tutorial no longer supports the old Microdata technology as JSON-LD is a lot faster to read for Google Bots.

This code now also supports id’s for Facebook, so you can import product data using structured data.

Supported Functions

  • Facebook ID value.
  • Auto currency detection
  • Auto decimal separator detection
  • Extra instructions to fix Opengraph pricing issues

Requirements

  • Google Merchant Center > Products > All Products
  • Access to Shopify > Theme > product.liquid

Important:
It is required you remove all your old structured data coding, to avoid conflicts. If you do not know how to do this, you can ask for my help using the contact form below

From the code example below, edit the value between code settings start and end. Do not change anything else or you might break the functionality. I have highlighted below what you can edit.

  1. By default the code is set up for the US, if you targeting a different country, change the value of fa_product_id_alpha2_code to your target country alpha2. For example, the United Kingdom is GB. You can find the full list here: https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/enum/countrycode
  2. The following step requires you to check the product id in Google Merchant Center > Products > List. And see what ID you are using.
    1. If it looks like shopify_US_81191654332_1055121650148, then keep fa_product_id set to default
    2. If it looks like 1055121650148 then set the value fa_product_id to product_id
    3. If it looks like the main id 81191654332 then set the value fa_product_id to parent_id
    4. If it looks like a sku then set the value fa_product_id to sku

The Code

<!-- Copyright FeedArmy 2021 Version 3.06 -->
<!-- FeedArmy tutorial found at https://feedarmy.com/kb/shopify-microdata-for-google-shopping/ -->

<!-- CODE SETTINGS START -->
<!-- CODE SETTINGS START -->

<!-- Please add your alpha2 code, you can find it here: https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/enum/countrycode -->
{%- assign fa_product_id_alpha2_code = 'GB' -%}

<!-- set your product id values are default, product_id, parent_id, sku-->
{%- assign fa_product_id = 'default' -%}

<!-- CODE SETTINGS END -->
<!-- CODE SETTINGS END -->

<!-- ==================================== -->
<!-- DO NOT EDIT ANYTHING BELOW THIS LINE -->

{%- if template contains 'product' -%}

{%- assign fa_current_variant = product.selected_or_first_available_variant -%}
{%- assign fa_variant_count = product.variants | size -%}
{%- assign fa_count = 0 -%}

{%- if fa_product_id == 'default' -%}
{%- capture fa_product_id_value -%}shopify_{{ fa_product_id_alpha2_code }}_{{ product.id }}_{{ fa_current_variant.id }}{%- endcapture -%}
{%- elsif fa_product_id == 'product_id' -%}
{%- capture fa_product_id_value -%}{{ fa_current_variant.id }}{%- endcapture -%}
{%- elsif fa_product_id == 'parent_id' -%}
{%- capture fa_product_id_value -%}{{product.id }}{%- endcapture -%}
{%- elsif fa_product_id == 'sku' -%}
{%- capture fa_product_id_value -%}{{ fa_current_variant.sku | escape }}{%- endcapture -%}
{%- endif -%}

{%- if cart.currency.iso_code == 'GBP' or cart.currency.iso_code == 'USD' or cart.currency.iso_code == 'AUD' or cart.currency.iso_code == 'BWP' or cart.currency.iso_code == 'BND' or cart.currency.iso_code == 'DOP' or cart.currency.iso_code == 'GTQ' or cart.currency.iso_code == 'HKD' or cart.currency.iso_code == 'INR' or cart.currency.iso_code == 'ILS' or cart.currency.iso_code == 'YEN' or cart.currency.iso_code == 'KES' or cart.currency.iso_code == 'KOR' or cart.currency.iso_code == 'LBP' or cart.currency.iso_code == 'MYR' or cart.currency.iso_code == 'MXN' or cart.currency.iso_code == 'NPR' or cart.currency.iso_code == 'NZD' or cart.currency.iso_code == 'NIO' or cart.currency.iso_code == 'NGN' or cart.currency.iso_code == 'PKR' or cart.currency.iso_code == 'CNY' or cart.currency.iso_code == 'PHP' or cart.currency.iso_code == 'SGD' or cart.currency.iso_code == 'LKR' or cart.currency.iso_code == 'CHF' or cart.currency.iso_code == 'TWD' or cart.currency.iso_code == 'TSH' or cart.currency.iso_code == 'THB' or cart.currency.iso_code == 'UGX' or cart.currency.iso_code == 'KWD' or cart.currency.iso_code == 'CLP' -%}
{%- assign fa_product_price = fa_current_variant.price | money_without_currency | remove:',' -%}
{%- else -%}
{%- assign fa_product_price = fa_current_variant.price | money_without_currency | remove:'.' | replace: ',', '.' -%}
{%- endif -%}


<script type="application/ld+json" data-creator_name="FeedArmy">
{
  "@context": "http://schema.org/",
  "@type": "Product",
  "name": "{{ product.title | strip_html | escape }}",
  "url": "{{ shop.url }}{{ product.url }}",
  "sku": "{{fa_product_id_value}}",
  {%- if product.variants.first.barcode.size == 12 -%}
    "gtin12": {{ product.variants.first.barcode }},
  {%- endif -%}
  {%- if product.variants.first.barcode.size == 13 -%}
    "gtin13": {{ product.variants.first.barcode }},
  {%- endif -%}
  {%- if product.variants.first.barcode.size == 14 -%}
    "gtin14": {{ product.variants.first.barcode }},
  {%- endif -%}
    "productID": "{{ product.id }}",
  "brand": {
    "@type": "Thing",
    "name": "{{ product.vendor | escape }}"
  },
  "description": {{ product.description | strip_html | json }},
  "image": "https:{{ product.featured_image.src | img_url: 'grande' }}",
  {%- if product.variants -%}
  {%- assign fa_count = fa_count | plus: 1 -%}
    "offers":
      {
        "@type" : "Offer",
        "priceCurrency": "{{ cart.currency.iso_code }}",
        "price": "{{ fa_product_price }}",
        "itemCondition" : "http://schema.org/NewCondition",
        "availability" : "http://schema.org/{% if fa_current_variant.available %}InStock{% else %}OutOfStock{% endif %}",
        "url" : "{{ shop.url }}{{ fa_current_variant.url }}",
            {%- if fa_current_variant.image -%}
              {%- assign variant_image_size = fa_current_variant.image.width | append: 'x' -%}
              "image": "https:{{ fa_current_variant.image.src | img_url: variant_image_size }}",
            {%- else -%}
              "image": "https:{{ product.featured_image.src | img_url: 'grande' }}",
            {%- endif -%}
            {%- if fa_current_variant.title != 'Default Title' -%}
              "name" : "{{ product.title | strip_html | escape }} - {{ fa_current_variant.title | escape }}",
            {%- else -%}
              "name" : "{{ product.title | strip_html | escape }}",
            {%- endif -%}
            {%- if fa_current_variant.barcode.size == 12 -%}
              "gtin12": {{ fa_current_variant.barcode }},
            {%- endif -%}
            {%- if fa_current_variant.barcode.size == 13 -%}
              "gtin13": {{ fa_current_variant.barcode }},
            {%- endif -%}
            {%- if fa_current_variant.barcode.size == 14 -%}
              "gtin14": {{ fa_current_variant.barcode }},
            {%- endif -%}
			         "sku": "{{fa_product_id_value}}",
            {%- if product.description != blank -%}
            "description" : {{ product.description | strip_html | json }},
            {%- endif -%}
          "priceValidUntil": "{{ 'now' | date: '%s' | plus: 31536000 | date: '%Y-%m-%d' | uri_encode | replace:'+','%20' }}"
      }
    {%- if product.variants.size > 1 -%},
      "additionalProperty": [{
        "@type": "PropertyValue",
        "propertyID": "item_group_id",
        "value": "{{ product.id }}"
      }]
      {%- endif -%}
    {%- if product.metafields.spr.reviews -%}
    {%- assign fa_rating = product.metafields.spr.reviews | split: '"reviewCount": "' | last | split: '"' | first | plus: 0 -%}
    {%- if fa_rating > 0 -%}
    ,"aggregateRating": {
     "@type": "AggregateRating",
     "ratingValue": {{ product.metafields.spr.reviews | split: '"ratingValue": "' | last | split: '"' | first | plus: 0 }},
     "ratingCount": {{ product.metafields.spr.reviews | split: '"reviewCount": "' | last | split: '"' | first | plus: 0 }}
    }
    {%- endif -%}
    {%- endif -%}
  {%- endif -%}
}
</script>
{%- endif -%}
<!-- Copyright FeedArmy 2021 Version 3.06 -->

Once the new coding has been added, it will take Google Merchant Center several days before the warnings inside your diagnostic panel disappear. The reason it takes so long is that Google does not check every page every day, but over a span of 30 days.

Here is a step by step guide on how to paste the code in your products.liquid file.

Installing The Code

  1. Log in to your Shopify Admin Panel
  2. Go to Online Store > Themes
  3. In the top right corner click on actions. A menu will appear and click on Edit Code
  1. Click on Templates > product.liquid
  1. The recommended place to paste the code is at the top. After installing the code, check that you did not break anything by checking the preview results of your product landing page.
  1. Remove the original Shopify review structured data, if you have added the widget in sections/product-template.liquid. This needs to be removed to ensure there are no warnings or errors. Search and replace the below code.

Search for:

<div id="shopify-product-reviews" data-id="{{product.id}}">{{ product.metafields.spr.reviews }}</div>

Replace with:

<div id="shopify-product-reviews" data-id="{{product.id}}"></div>

Step 7

Verify that you have done it correctly by checking the page with Google’s Structured Data Testing Tool

And also check Facebook’s data testing tool.

You will see 1 warning

  • The review field is recommended. Please provide a value if available.
    • This can’t be added and should be added by the review app you are using.

The aggregatedReviews in this script only extract data for the default Shopify review system, if you have other review systems such as yotpo, stamped, judgeme, loox, etc… then please contact me at the bottom of this article for a custom installation.

If you want to succeed in your advertising efforts, why not hire a Google Shopping Specialist!

Fix Opengraph

A newly found issue for a few months now is related to Opengraph. It seems that sometimes Google looks at the Opengraph Price Amount. The issue here is that in most cases it will show the first variant that you created in Shopify. Instead of the selected variant. I did not mention this prior to 30th of April 2021, however Optily a merchant confirmed the existence of this issue and I have now decided to update this article to fix this issue too.

Step 1) Edit Liquid File

Go to:

  1. Open Your Shopify Admin
  2. Click from the left hand menu on Online Store
  3. Select Themes
  4. From the file folder navigate to the folder Snippets
  5. Open social-meta-tags.liquid

Step 2) Replace Coding

Near the bottom of the file you will see two lines wrapped inside an if statement that checks if the page is equal to product.

{% if template.name == 'product' %}
  <meta property="og:price:amount" content="{{ product.price | money_without_currency | strip_html }}">
  <meta property="og:price:currency" content="{{ shop.currency }}">
{% endif %}

Replace the above code with the below code.

{% if template.name == 'product' %}
	{%- assign fa_current_variant = product.selected_or_first_available_variant -%}
	{%- if cart.currency.iso_code == 'GBP' or cart.currency.iso_code == 'USD' or cart.currency.iso_code == 'AUD' or cart.currency.iso_code == 'BWP' or cart.currency.iso_code == 'BND' or cart.currency.iso_code == 'DOP' or cart.currency.iso_code == 'GTQ' or cart.currency.iso_code == 'HKD' or cart.currency.iso_code == 'INR' or cart.currency.iso_code == 'ILS' or cart.currency.iso_code == 'YEN' or cart.currency.iso_code == 'KES' or cart.currency.iso_code == 'KOR' or cart.currency.iso_code == 'LBP' or cart.currency.iso_code == 'MYR' or cart.currency.iso_code == 'MXN' or cart.currency.iso_code == 'NPR' or cart.currency.iso_code == 'NZD' or cart.currency.iso_code == 'NIO' or cart.currency.iso_code == 'NGN' or cart.currency.iso_code == 'PKR' or cart.currency.iso_code == 'CNY' or cart.currency.iso_code == 'PHP' or cart.currency.iso_code == 'SGD' or cart.currency.iso_code == 'LKR' or cart.currency.iso_code == 'CHF' or cart.currency.iso_code == 'TWD' or cart.currency.iso_code == 'TSH' or cart.currency.iso_code == 'THB' or cart.currency.iso_code == 'UGX' or cart.currency.iso_code == 'KWD' or cart.currency.iso_code == 'CLP' -%}
    {%- assign fa_product_price = fa_current_variant.price | money_without_currency | remove:',' -%}
    {%- else -%}
    {%- assign fa_product_price = fa_current_variant.price | money_without_currency | remove:'.' | replace: ',', '.' -%}
    {%- endif -%}
    <meta property="og:price:amount" content="{{ fa_product_price }}">
    <meta property="og:price:currency" content="{{ cart.currency.iso_code }}">
{% endif %}

It should look like the image below.

For this to work, you do need to install my structured data at the top of the page.

Change Log

  • 13 September 2021: Updated opengraph code
  • V3.06 – 25 August 2021: Updated SKU attribute to escape special characters
  • V3.05 – 19 August 2021: Updated currency detection to include Chilean Peso
  • V3.04 – 17 July 2021: Updated list of dot delimiter used in countries

Need Help?
Do You have a question or need specialist support? Get in touch!

194 thoughts on “Adding Structured Data to Shopify for Google Merchant & Facebook (JSON-LD)”

  1. Hi,
    you wrote on the article to write you down here if I am using other app for reviews than the basic Shopify one for code modification.

    I am using Judge.me app for reviews. Can you please help me with the code customization to fix the issue?

    Please help me

  2. Hi Emmanuel,

    I’m currently using your code in my customized Debut theme, but I’m in the process of migrating to the new Shopify 2.0 Dawn theme. In their new set up I can’t find the structured data anywhere, the product.liquid is now a json file and in the main-product.liquid section is no mention of structured data either (I checked all the other sections and snippets too, to be sure). Where should I paste this code now and why would they have decided not to include it anymore in the Dawn theme?
    Thanks in advance, much appreciated.

  3. Hi Emmanuel

    Thank for the 3.02 update. However, I’m not sure if it supports my DKK currency? Previously versions had the ‘false’ parameter for European currency format.

    DKK is also 1.000,00 – but from how I read the code, it only changes from 1,000.00 to 1.000,00 if the currency is EUR, right?

    I don’t have much coding knowledge, so I just wanted to be sure before I update. I’m running af multi-currency store with both DKK, USD, EUR, CAD, AUD and SEK.

  4. THANKS For this!!!
    I have 2 Questions:
    1) Why is there a counter for the variants that appears to be unused?
    2) Why aren’t you looping through the variants and showing all the offers?
    Currently, we are getting price mismatch errors on a few products. We have some products with 50+ variants and these seem to be the ones that are creating the most issues. I’m also wondering why are you using the shopify_us_{{product_id}}_{{variant_id}} in the SKU field?

    1. Pleasure
      1) This is old coding and will be removed in the next update
      2) Because the old coding was no longer valid, and requires a different set of attributes.
      This code will always show the correct variant data.
      Because some merchants use the default Shopify id as the item id in the data feed and thus need to match. If you don’t need it, simply ignore it and choose a different option.

  5. Hi, when google crawls, it doesn’t seem to get the actual right prices.When i test my structured data, prices appear without a “,”.But I did everything as you told and it doesn’t work. Do you know how i can make it work ?Price is supposed to be 99,90€ https://uploads.disquscdn.c

    1. Emmanuel Flossie

      change {% assign fa_prices_with_decimal_separator = true %} to {% assign fa_prices_with_decimal_separator = false %}

  6. Hey there, just wanted to hop in and say this code worked amazingly. I am using Narrative theme on a client’s site and started getting warnings from Google on her products. I added “the code” to the top of the Narrative theme product.liquid file, and I removed all original Product meta code from the product-template.liquid file. Used the schema testing tool and warnings immediately dropped from 6 to 3, with only the ones remaining that either he said would remain because of reviews and one that we just don’t have filled in yet (sku).

    This was such an easy fix. PLEASE keep coming back and updating this code as you can. it is a wealth of knowledge.

  7. Hi there.

    I’m using the lastest Minmal theme – and I have this in top of my product-template.

    Now I assume your nice script does not take into account the extra tab in theme, right?

    <

    div id=”ProductSection” data-section-id=”{{ section.id }}” data-section-type=”product-template” data-image-zoom-type=”{{ section.settings.product_image_zoom_type }}” data-show-extra-tab=”{{ section.settings.show_extra_tab }}” data-extra-tab-content=”{{ section.settings.extra_tab_content }}” data-enable-history-state=”true”>

    Regards,
    Kenneth

    1. Another thing: The step 6 – to remove {{ product.metafields.spr.reviews }} – doesn’t that mean that my reviews will actually not show on the product page? Because I would like them to show 🙂

      At the moment I’m only showing this part if there are any reviews – with this simple code:


      {% if product.metafields.spr.reviews %}

      {{ product.metafields.spr.reviews }}

      {% endif %}

  8. Will this code work for express theme and if I don’t have any review app installed? Tried to use it but my product page is now blank

  9. Hello,

    I inserted your code and want to know if this the correct way it should look in rich results.

    Picture 1: Is the first sku that shows up supposed to be the sku when you go to the link with no variant ending in the url?

    https://uploads.disquscdn.com/images/9ef9b5173f982916631cbf003635fb7e521da33f9d533116a7f42971bff4aafe.png

    Picture 2: Shows the correct sku and price of the variant url/id. (this is right after you scroll down from picture one)

    https://uploads.disquscdn.com/images/5f02d260f026ef11456a0c5669c99f14eb69694a8d8e2fdf49647894d4899c1e.png

    I think this is correct but please, let me know if it is wrong.
    https://search.google.com/test/rich-results?id=0myjYPvSV1MN4LmY597DgA

  10. Hello I added your code and now when I run the Structured Data Test, Google is doubling the result, the first result gives two warnings the second 4 as nothing has changed. I’m also having Judge.me app installed.
    When I’m trying to validate the fix on Google Search Console for ‘priceValidUntil’ and global identifier provided (e.g. gtin, mpn, isbn) it’s getting rejected.
    https://www.sussexspecial.co.uk/products/oriental-delight-luxe-soy-wax-candle

    https://uploads.disquscdn.com/images/d15fe336b36edc13a37aa84eafc854a3b57d791ba9bd28aac5c2d1a6e85fb778.jpg

    1. The tutorial supports the default Shopify reviews. You will continue to see warning, until you have reviews. So make sure you have reviews. Warnings can safely be ignored if you can’t add the data.

  11. Hi,
    I am using minimal theme and Shopify Product Reviews. I installed the above code, and changed the code as per Step 6. But am getting the following 2 errors from Google Search Console:

    Value in property ‘ratingCount’ must be positive
    Rating is missing required best and/or worst values

    What can be done?

  12. Hello, I just tried your code above using the instructions provided and in the Facebook Microdata Debug Tool, just get a “Data validation failed. There was a problem while verifying your website. Please try again.” message whe I point it at any of the product pages. We are using the Parallax template (so maybe something weird there) and the stamped.io review widget. Any suggestions would be appreciated. Thanks

  13. Emmanuel, Just wanted to repeat again, thanks for your updates, I was getting a few errors on version 2.34 I have since updated to 2.37 – now facebook says Congratulations! Your microdata looks great!

  14. Hi, I recently tried your snippet for my shopify site. It seems like json validators (and google) doesn’t like my description field containing new lines. My description field is quite long and it fails on that.Below is the output, which shows my long description field.Any ideas on this?Thanks!{ “@context”: “http://schema.org/”, “@type”: “Product”, “name”: “Singer Heavy Duty 4432 *** ON SPECIAL ***”, “url”: “https://sewingmachinecentre.nz/products/heavy-duty-4432″,”sku”: “Singer-4432″,”productID”: “3670132228148”, “brand”: { “@type”: “Thing”, “name”: “Singer” }, “description”: “The big brother of the Singer Heavy Duty 4423, the Singer Heavy Duty 4432 offters an additional 9 stitch types over the Singer HD 4423. The Singer HD4432 offers more room to grow as a sewist and is a very robust machine, which means it will stand the test of time.With a heavy-duty metal interior frame, stainless steel bed plate, extra-high sewing speed and powerful motor this is a true work horse. It comes complete with automatic needle threader (sewing’s biggest time saver) and the machine’s 1,100 stitches per minute speed allows you to bring your creative ideas to life quickly.Features32 Built-in Stitches50 Stitch FunctionsLED lighting –brighter lightingAutomatic 1-step ButtonholeAutomatic Needle ThreaderExtra High Speed Sewing –1,100 stitches per minuteStainless Steel Bed PlateAdjustable Presser Foot PressureHorizontal Thread DeliveryExtra High Presser Foot LiftDrop Feed SystemProvision for Mounting in Cabinet or TableReverse OperationFree-Arm DesignInstruction ManualHeavy Duty Metal FrameMetal Bobbin WinderAuto TensionTop Drop-In Bobbin SystemVariable Stitch LengthVariable Stitch WidthAuto Bobbin WindingSnap on Presser FeetBuilt-In StorageIncluded Accessories General Purpose FootButton Sewing FootButtonhole FootZipper FootEdge / Quilting GuideSeam Ripper / Lint BrushBobbinsSpool CapsAuxiliary Spool PinsSpool Pin FeltL-ScrewdriverPack of NeedlesDust Cover”, “image”: “https://cdn.shopify.com/s/files/1/0070/6327/3524/products/4432_Global_beauty_baa9e82b-4316-469e-80be-384920aaf1f2_grande.png?v=1557885939″,”offers”: { “@type” : “Offer”, “priceCurrency”: “NZD”, “price”: “539.00”, “itemCondition” : “http://schema.org/NewCondition”, “availability” : “http://schema.org/InStock”, “url” : “https://sewingmachinecentre.nz/products/heavy-duty-4432?variant=28543676121140″,”image”: “https://cdn.shopify.com/s/files/1/0070/6327/3524/products/4432_Global_beauty_baa9e82b-4316-469e-80be-384920aaf1f2_grande.png?v=1557885939″,”name” : “Singer Heavy Duty 4432 *** ON SPECIAL ***”,”sku”: “Singer-4432″,”description” : “The big brother of the Singer Heavy Duty 4423, the Singer Heavy Duty 4432 offters an additional 9 stitch types over the Singer HD 4423. The Singer HD4432 offers more room to grow as a sewist and is a very robust machine, which means it will stand the test of time.With a heavy-duty metal interior frame, stainless steel bed plate, extra-high sewing speed and powerful motor this is a true work horse. It comes complete with automatic needle threader (sewing’s biggest time saver) and the machine’s 1,100 stitches per minute speed allows you to bring your creative ideas to life quickly.Features32 Built-in Stitches50 Stitch FunctionsLED lighting –brighter lightingAutomatic 1-step ButtonholeAutomatic Needle ThreaderExtra High Speed Sewing –1,100 stitches per minuteStainless Steel Bed PlateAdjustable Presser Foot PressureHorizontal Thread DeliveryExtra High Presser Foot LiftDrop Feed SystemProvision for Mounting in Cabinet or TableReverse OperationFree-Arm DesignInstruction ManualHeavy Duty Metal FrameMetal Bobbin WinderAuto TensionTop Drop-In Bobbin SystemVariable Stitch LengthVariable Stitch WidthAuto Bobbin WindingSnap on Presser FeetBuilt-In StorageIncluded Accessories General Purpose FootButton Sewing FootButtonhole FootZipper FootEdge / Quilting GuideSeam Ripper / Lint BrushBobbinsSpool CapsAuxiliary Spool PinsSpool Pin FeltL-ScrewdriverPack of NeedlesDust Cover”,”priceValidUntil”: “2021-06-05″ },”aggregateRating”: { “@type”: “AggregateRating”, “ratingValue”: 5.0, “ratingCount”: 1 }}

    1. Emmanuel Flossie

      Hello Albert, thank you for reporting and explaining your issue, I have changed the code to remove all the lines and show it in one line. Please test the new version out in this tutorial.

  15. Hello the code is not working for me it is still showing me all those errors. I completely replaced everything in product.liquid file with what you said and I can find the code in product-related.liquid. Still getting the same errors. Please help

  16. Hi, i tried to change from “priceCurrency”: “{{shop.currency}}”,to: “priceCurrency”: “{{ cart.currency.iso_code }}”,and it seems work

    1. Emmanuel Flossie

      Thank you for the suggestion, I looked at it and it does seem to work on the default settings. Did not test all currency apps, as it seems some don’t work.

  17. Hi, we installed your code, we have a question: we have multple currencies on our store, if we test the structured data we have no error but the currency in the data is always EUR also by entering the direct link for the currency in GBPon the feed and on the website the right currencies are displayed but the bot on the structured data test crawl always the default shop currency (EUR) can we fix it?

    1. Emmanuel Flossie

      Hi, the multiple currencies will be via an app you are using. So this app should make all the required changes. I recommend you contact them for support on this. This is unfortunately not something I can help with.

  18. Where on the page do you embed this script? Just after the review code? <div id=”shopify-product-reviews” data-id=”{{product.id}}”></div>This should ensure Rich Results and googlebot does not pick up the duplicate content?

    1. Emmanuel Flossie

      Most likely you overlooked where it is installed. Shopify has recently added it multiple times, which I noticed after Joost made a comment about it. Check all product related pages. Depending on your theme this will be different for each setup. If you need personal assistance, please email me [email protected]

      1. Yes correct. It appears in both ‘view source’ and ‘inspect’. Duplicated generated automatically by Shopify Product Reviews App. Looking for a way to disable it so only one version shows. Remove the meta details as per above comments also and it still shows up. Did you get the script working? Where did you embed it?

  19. Hey Emmanuel. Thanks for replying. Really appreciate the effort.I think I got my confusion:- If you remove {{ product.metafields.spr.reviews }} the JSON doesn’t appear in the page source (server response), but does appear in ‘inspect element’ (client side rendering).- How I interpret this:– removing it is sufficient to prevent any errors for the Google bots– adding my additional JS (.remove() ), will not have effect on Google Bots, but also cannot hurt and is more for my personal satisfaction that the duplicating is not ending up in browser parsed code.Does that make sense to you?

    1. Emmanuel Flossie

      Yes your absolutely correct. It makes sense and completely valid. Thanks for your clarification! 🙂

      1. Check the comments from Emmanuel. It looks like you don’t need that JS. First check if you see the duplicated JSONO when you check your HTML (view source, not through inspect).

    1. Emmanuel Flossie

      Make sure you have reviews, if there are no reviews, then the aggregateRating can not show.As mentioned in the tutorial, the script does not support review, you need to contact your review app on how to add reviews.Make sure to add bar codes to your products for global identifiers to show.

  20. It looks like Shopify has updated their review app? When I remove {{ product.metafields.spr.reviews }} it still loads the JSON from the app, resulting in duplicates. Any tip how to prevent this from happening?

    1. I think I figured it out, so for reference:<script> var SPRCallbacks = { onProductLoad: function( e ) { $(‘#shopify-product-reviews [type=”application/ld json”]’).remove(); }, onReviewsLoad: function( e ) { $(‘#shopify-product-reviews [type=”application/ld json”]’).remove(); } } </script>

      1. Emmanuel Flossie

        I can not confirm this is the case, while yes Shopify added it multiple times again, if you remove {{ product.metafields.spr.reviews }} in the theme, it is all removed and everything is valid. So you might have overlooked where the code is added.If you remove the data via javascript, it will not do anything with regards to Google Merchant Center. javascript will only render client side, and not server side. This means when Google crawls your page, it will read server side with respect to Google Merchant Center bot. I have read this solution on Shopify’s community many times, but it’s unfortunately not the solution.The only solution is to remove {{ product.metafields.spr.reviews }} from the theme. I have just checked and can confirm this is still correct and working.

  21. Hi, Thank you so much for this code!I just have one question, I’m using Loox as my review app. It seems that Loox has already add the schema code by itself.Can I just delete this review code to avoid warning? {%- if product.metafields.spr.reviews -%} ,”aggregateRating”: { “@type”: “AggregateRating”, “ratingValue”: {{ product.metafields.spr.reviews | split: ‘”ratingValue”: “‘ | last | split: ‘”‘ | first | plus: 0 }}, “ratingCount”: {{ product.metafields.spr.reviews | split: ‘reviewCount”: “‘ | last | split: ‘”‘ | first | plus: 0 }} } {%- endif -%}Best RegardsDarcy

    1. Emmanuel Flossie

      To avoid a warning, you must have everything in one container. If you split it up, you will see you get warnings in Google’s structured data testing tool. If you like I can merge the data together. If you need my help, contact me [email protected]

  22. https://uploads.disquscdn.c… I am facing issue on product page all the other fields are solved expected this two 1.aggregateRating 2. reviewI have used this code <meta itemprop=”image” content=”https:{{ product.featured_image.src | img_url: ‘grande’ }}”/> {% if product.variants.first.barcode == blank %} <meta itemprop=”gtin8″ content=”-“/> {% else %} <meta itemprop=”gtin8″ content=”{{ product.variants.first.barcode }}”/> {% endif %} <meta itemprop=”brand” content=”{{ product.vendor }}”/> <meta itemprop=”sku” content=”{{ product.variants.first.sku }}”/>and for reviews <div id=”shopify-product-reviews” data-id=”{{product.id}}”></div>

    1. Emmanuel Flossie

      Hello that looks like old coding, you should remove this so that it does not show the data and only use my script in the tutorial. If you need any help please contact me [email protected]

  23. Hi,the code works very well but I am having trouble with the price. Since we are using the German presentation of prices we are using a “,” instead of “.” to separate decimal places (19,95€ instead of 19.95€). The structured data now shows all prices without a “,”, resulting in 1995€.I have removed the “remove: ‘,’ ” portion of your code but that doesn’t fix the problem. How can I fix the error?

    1. Nevermind, I just fixed the error. For anyone else from Germany having the same problem: You need to edit the general settings of your shopify store and change the currency formatting to {{amount}}. In our store was initially set to {{amount_with_comma_separator}}.

      1. Hello Ben, you can also change the code as followed from remove: ‘,’ to remove:’.’ | replace: ‘,’, ‘.’

  24. Hello, the code works very well for all the fields except for the notices, I still have 3 warnings about the aggregated notices .. however I have your tutorial correctly

    1. Hello Colinas, make sure that you have reviews from Shopify Reviews app. If you have no reviews, then yes you will see warnings. If you are using a different review system such as yotpo, judgeme, etc… a different code needs to be installed. You can contact me [email protected] to order the code.

  25. Thank you SO MUCH! Great work here. Well done.However using the Facebook testing tool it reports the following Errors:A required field is missing: id (Products without “id” information can’t be uploaded. Please check that this field is included for each product in a separate, labeled column.)A required field is missing: availability (Products need to have availability listed to run in ads. Include the current availability for each product in your data feed file and upload it again. You can only add the supported values “in stock”, “out of stock”, “preorder”, “available for order”, “discontinued”, “pending” in US English under the “availability” column.)And the following Warning:A product is missing a field: google_product_category (Without google_product_category information, your products may not appear the way you want them to in ads.)Looks like availability is there but there is a conflict between the values Google and Facebook will accept (Facebook seems to expect spaces?)

  26. Thanks Emmanuel again for updated code – version 2.34 – working fine for reviewed product(s)https://uploads.disquscdn.c…

  27. I’m having 2 new errors from Google that say the following:Rating is missing required best and/or worst valuesValue in property “ratingCount” must be positiveAll of my products have reviews and so I’m confused but the code is putting out that the aggregate rating is showing my ratingValue and ratingCount as 0. Any idea what would be causing this?

    1. This same thing also happened to me and I am using Shopify’s default review app along with the brooklyn theme. Any ideas?

  28. Code was working just fine, untill today “ratingValue”: “ratingCount”: have started returning “0” value.

  29. Thanks for your help. T fix The aggregatedReviews fields what code I need if I’m using Rivyo Product Review App ?

    1. Emmanuel Flossie

      This can happen when there is a misconfiguration in your review options. I have only seen this once before and it was due to the review system stamped being used, while it was also working with shopify reviews. Not sure, this needs careful investigation. If you like to have my support. Please email me [email protected]

  30. Thanks for your post. Worked fine. Just missing field ‘review’ (optional) as you predicted. Crawled successfully on 10 Jan 2020, 15:08:56

    1. Emmanuel Flossie

      Ah that is not my coding or caused by my coding, as the 2 warnings that you see on the product container is from my code (which is correct). The 1 error and 5 warnings on the aggregaterating container is from your Shopify App. So I recommend you contact Shopify to fix the issue. I recommend you check if the app allows you to disable structured data. I have seen other review apps allowing you to do this. If however you need personal assistance, then please email me [email protected]

  31. I am still getting an error as previous users have also reported even though I have deleted all metadata code in my theme code. It has to do with the aggregate rating that is added to my site via the Shopify product reviews app, which as far as I know I am unable to edit myself.Any updates on this?

    1. Emmanuel Flossie

      Hi Tim, the issues of previous users, are either unrelated, from old coding issues, or due to conflicts from other coding in the theme. My current code just tested for your case is working as expected. If you have other apps that do not work correctly, I recommend you contact the app developer, some apps allow you to disable structured data without losing the main functionality. Please remember that aggregated rating can only show if you have reviews. If you don’t have reviews it will indeed give you a warning. Also note warnings and errors are not alike. A warning means it is optional and you can add this to get extra features on Google Search. While an error is a structure issue or missing required attributes. aggregatedRating is not a required attribute and thus can only give you a warning, not an error. Unless you have made changes to the structure and made it show incorrect.

  32. They are errors according to my email from Google:Top ErrorsErrors can prevent your page or feature from appearing in Search results. The following errors were found on your site:Missing field “lowPrice”Missing field “priceCurrency”

    1. Emmanuel Flossie

      Then most likely you have old structured data, as my coding includes priceCurrency. Please note that simply adding my code while having old structured data will not work. You need to remove old structured data sets. If you need any help, please email [email protected]

  33. Google Console is indicating errors of Missing field “lowPrice” and Missing field “priceCurrency” Is this something that needs new code? Thanks!

    1. Emmanuel Flossie

      First make sure you read the details correctly, as most likely it says warning, not error. There is a very big difference. Warnings are optional data that you can add, while errors are required or issues. My code already shows priceCurrency.LowPrice is not shown this requires custom coding if it’s applicable to your shop. If you want further help with this custom integration, please email [email protected]

  34. I think the problem here is that the problems listed above are part of the code that is injected into the page by the Shopify Product Reviews shortcode. So, it is hard to limit the app itself from inserting the JSON metadata.I’m having the same issue. In the Google tester. I get 3 items: Organization, Product, & Aggregaterating. I am using the Shopify Product Reviews app myself, but don’t know how to delete the structured data since it is written in the app.Any help or thoughts? You might want to look into this because it isn’t working so well with the SPR app. https://uploads.disquscdn.c

    1. Emmanuel Flossie

      That is not how the structured data tool works. You need to paste either the whole landing page data, by viewing the source code. Or enter the product landing page. Not my code, as that indeed will not work. My code can only work when you add it to the theme file in Shopify.

  35. Hi, currently getting 5 warnings and 1 error related to AggregateRating.warning – brand warning – descriptionwarning – imagewarning – skuwarning – global identifiererror – One of offers or review or aggregateRating should be provided.The error seems to be related to shopify’s review code<div class=”spr-container”> <div class=”spr-header”> <h2 class=”spr-header-title”>Customer Reviews</h2><div class=”spr-summary” itemscope=”” itemprop=”aggregateRating” itemtype=”http://schema.org/Aggregate…”> <div itemprop=”itemReviewed” itemscope=”” itemtype=”http://schema.org/Product”> <meta itemprop=”name” content=”Bud&amp;Babe Natural Deodorant (Original)”> </div>Are these conflicting schema entries or should it work with the free review app ?Cheers

    1. Make sure to remove any old structured data codes from the theme, as my code will automatically add aggregaterating. Your warnings and errors regarding this will be resolved.

  36. Hi, current description concatenates two lines like this “LineALineB” if the second is in new line. I changed it to {{ product.description | strip_html | json }} to solve it

    1. also if the product doesnt have gtin etc it produces a lot of white space, I fixed that by replacing every {% & %} with {%- & -%}

      1. Thank you for your contribution, I have updated the code and mentioned you as a contributor to the change log. 🙂

    2. Hello, adding json, will invalidate the structured data, so instead I removed the strip new line function. Thank you for reporting your issue. Code updated to 2.33

  37. Hey mate, I’ve fixed an error in your script. The forloop should only 1 fa_count if it actually outputs a variant. There was a problem with products for which only the last variant was still in stock. The count jumped by 2 at some stage resulting in a comma “,” after the last item which rendered the JSON invalid. See attached… Cheers and thanks for the otherwise great help and starting point this provided. https://uploads.disquscdn.c

    1. Emmanuel Flossie

      Hello Alex, thank you very much for your contribution. The code is updated and have place your name as a contributor to the change log.

  38. Hey Emmanuel, Just an observation.. It looks like you still have version 2.29 up. Sent a help request through your contact form for custom integration and i look forward to hearing back from you!Enjoy the Google meetup, catch you when you return.:)

    1. Emmanuel Flossie

      Hello Honnah, thank you for reporting the versioning, I will be updating the code this week. Just flying back to Thailand tomorrow and will work on an update, you can check back in a week. I should have it ready by then. Thanks.

  39. Emmanuel Flossie

    Hi, thank you for the continues bug reporting. I have reverted back to a previous version as currently I’m in Dublin at Google’s yearly product expert meetup and can’t work on a fix. So when I’m back next week. I’ll look into this. Thank you for your patience.

  40. Dylan McCullough

    Found another issue with an item that has 2 Variants, the first of which is unavailable. Throws a parse error in structured data.https://www.thecostumekitty… is URL for example”Syntax error: value, object or array expected.” Is the error.It seems to be putting a “,” after the last variant’s offer even though there is none which throws the error.

    1. Emmanuel Flossie

      Hello Dylan, thank you for reporting this issue. I have fixed this, please update the code to version 2.28.

      1. Dylan McCullough

        Hello,Found an issue (maybe an issue?) with items that have no variants but are displaying as having variants with names of “Item – Default Title” as their “Offer name”.https://www.thecostumekitty… is an example of a single item with no variant that is registering as having a variant in the structured data. I’ve been getting some errors / weird behavior with items popping up as Default Title for their name.ALSO, is there a donate page I can visit? This tool has been fantastic, and the updating has been equally fantastic.

        1. Emmanuel Flossie

          Hello Dylan, thanks for the further bug report. I have updated the code to version 2.29. This should fix this issue based on my tests. Kind regards, Emmanuel.

          1. Dylan McCullough

            Looks like the parse error issue persists with items that have available variants sandwiched in between non-available variants.This is an example from the structured data testing tool. Seems to be missing a “,” after the 2nd variant, and before the 3rd unavailable variant.https://search.google.com/s

          2. Emmanuel Flossie

            Hello Dylan, thank you for reporting all these issues. Your contribution is great. And very kind of you to offer a donation. If you like to donate, you can use PayPal and send it [email protected] have fixed this issue in version 2.30Kind regards, Emmanuel.

  41. Thank you, your code was helpful. We are using the shopify product reviews app. This app was generating an error in google search console in “products” structured data. The error was “One of offers or review or aggregateRating should be provided.” After installing your code on our product.liquid theme file this error has disappeared in the products schema code, but a new schema has appeared called “AggregateRating” and now the error “One of offers or review or aggregateRating should be provided.” is appearing in there instead. We are using googles structured data tool to test. The product in question is https://cigardagger.com//pr…If you have any insight into how we fix this I would be eternally grateful.

    1. Emmanuel Flossie

      Hello Lisa, pleasure. That error you see is not from my code but an old code on your site. You need to edit your theme to remove this. If you like my assistance with this, please email me [email protected] you look at Products schema, you will get two warnings, which is normal when you have reviews, which I can’t add and missing barcode, this will work when you add the bar codes in your shopify account.The aggregated section is not part of my code.

  42. This code worked great for almost everything! Thanks!Got an error “Thing is not a known valid target type for the itemReviewed property.” Can I change “Thing” to something else to satisfy the Structured Data Testing Tool?

  43. Hi, this is great and thank you! By any chance are you able to provide the modified code with the Yotpo review changes? Thanks again! Tane

      1. Hello Susan, I have fixed the availability status, however the issue in your image, I could not replicate. If the updated code does not resolve your issue, I may need to offer you my services. If you need it, please contact [email protected]

  44. FYI, the product description should have strip_newlines filter added. Facebook pixel seems to barf otherwise. “fbevents.js:24 [Facebook Pixel] – Unable to parse JSON-LD tag. Malformed JSON found: ‘”I see weight added on Offer, but that is not a legitimate attribute for Offer. “The property weight is not recognized by Google for an object of type Offer.”BTW, Thanks for this!

    1. Emmanuel Flossie

      Hi and thank you for your contribution. And it does indeed seem weight is not supported, so this is removed. And I have updated the description filters. Thanks!

  45. Two questions:(1) Price wasn’t coming up as valid format when I did a Structured Data Test. I had to change it to: “price”: “{{ variant.price | divided_by: 100.00 }}”, If you have a better suggestion, please let me know.(2) What about the MPN? What code should be added to get rid of the MPN warning?

    1. Think I figured out my (2) issue…I added this in the product section and it worked:{% if product.first_available_variant.sku != blank %}”mpn”: “{{ product.first_available_variant.sku }}”,{% else %}”mpn”: “{{ product.first_available_var… }}”,{% endif %}But would still like suggestions on (1) question.

      1. Emmanuel Flossie

        SKU is not MPN, nor is a variant ID an MPN. MPN stands for Manufacturer Part Number and can only be assigned by the manufacturer. In all cases never fabricate or fake data just to remove warnings. Warnings can be ignored if no valid data is available.

        1. Hi Emmanuel,We use the manufacturer’s part number (MPN) for our SKU’s…that goes for a product’s variants as well. So in our case MPN is the SKU. This isn’t unusual. Surprised you’ve not come across this before.

          1. Emmanuel Flossie

            I have not tested your code, I suggest you check the results and see if it is correct. If you like assistance with custom coding, please email me [email protected] regards to MPN, sure if the results are correct, you can use any field you desire, however the code you created says if SKU is empty then add variant id, hence the reason I mentioned never fabricate the data. This to avoid any issues with Google ranking your product data as it will then be inaccurate.

          2. Found an apparent problem…at least in our case. The script is not returning variant pricing. It is only returning the “first” price for all variants. This is flagging products in our feed and Google is not showing them. How can this be remedied?

          3. I’m getting a warning on price on items over $1000. It says, “1,595.00 (The property 1,595.00 is not a valid price specification. Learn more about http://schema.org/price.)Is this a problem? How is it fixed?

          4. Emmanuel Flossie

            Thank you for reporting the issue, this has been updated now. Please replace your existing code with the new updated one from the tutorial.

          5. Emmanuel…we are getting another problem with pricing. We have products with many variants…and all of the variants have different prices. Google Shopping Ads is having trouble matching the variant prices on the feed with accompanying variant price on the website. It therefore gives a mismatched price page crawl error and disapproves the items. I’ve attached a pic. The “value in feed” is correct for the variants listed. However, the “value on website” price is wrong. In every case, instead of properly matching the “value in feed” with its corresponding variant on the website, it matches it to the price for the default/first variant price. Therefore it doesn’t match.I tried to attach the pic but it says I must be logged in. I am logged in. Here is a link to the picture – https://cdn2.shopify.com/s/

          6. Emmanuel Flossie

            Thank you for reporting the issue. That has been updated, please use the updated code from the tutorial.

          7. Emmanuel,It now doesn’t work for items with no variants. It did seem to fix the ones with variants however.I’ve attached a picture of the error I’m getting on an item that has no variants. Can you get me a fix for this??https://cdn2.shopify.com/s/

          8. Emmanuel Flossie

            That I can not resolve, this is caused when you create a product with only one variant. I recommend you change the product as a non variant as in this case you are only listing one item. Hope this helps.

          9. Please note that the error screen shotted in my previous response was on an item that had over 4 variants. So I think there is some miscommunication. Also, there is no such thing on our website as an item with one variant. Every item either has no variants or 2 or more. Look forward to resolution.

    2. Emmanuel Flossie

      Hello, with regards to point 1), interesting, this might be something unique related to you. If you like help with this, please contact me [email protected] Point 2) Shopify does not have an MPN field.Also note warnings are optional, it does not mean you are required to add this. Make sure you do not submit any inaccurate data as this may effect your products in a negative way.

  46. Hello there,i paste the feedarmy JSON-LD code in my product template in my minimal Theme https://uploads.disquscdn.c…when i test my products url in the testing tool of google i have this : https://uploads.disquscdn.chttps://uploads.disquscdn.c…i end up with 2 product structured data, how can i remove the first product structured data ? (i suppose it’s the old microdata in the minimal theme)and in the second product structured data i have this : https://uploads.disquscdn.c…How can i fix these warnings knowing that i have reviews in my products thanks to the app “products reviews” ?thanks in advance for your answer.

    1. Emmanuel Flossie

      Unfortunately as each theme is different, I will not be able to explain how to remove it. You need to study up on theme editing and structured data if you like to do this yourself. However I do offer a service to do this for you. Please contact me [email protected] mentioned in the article, the code does not support priceValidUntil, aggregateRating or review. You will need to manually code this in or use an app.

  47. Hi I have tried to place the JSON-LD code in different places, i either get the same warnings or more warnings and errors. I attached my product liquid file.Thank you for any help!Suehttps://uploads.disquscdn.c…

  48. Hi, and thank you for taking time ton explain all this difficult things. I’ve many questions, i want to show images on search results near a specific product, and other images near specific collection of my website.Can you explain me how i can do that ?i attach a file as an example that i’ve see, it’s more explicit.(sorry for my bad english) https://uploads.disquscdn.c

    1. Emmanuel Flossie

      Hi unfortunately that is beyond the scope of the tutorial. However I am happy to reply to your email to set this up as a job. Will reply shortly.

    1. Emmanuel Flossie

      The image you showed is not Google Merchant Center, this is from the structured data tool. You can ignore the 3 attributes I mentioned in this article. The URL should be fixed, so you might have other coding or incorrectly pasted the code in this article. For global identifiers, make sure to add these in Shopify. Hope this helps.

  49. Jamie Mitchell

    Hello Emmanuel,I am restarting. I removed everything I tried on (line 14). Here is a sample of my product liquid, where would you insert your JSON LD Structured Data to my Shopify store for Google Merchant ?<div class=”sixteen columns”> <div class=”clearfix breadcrumb-collection”> <div class=”nav_arrows breadcrumb_text”> {% if collection.previous_product %} {{ ‘products.general.previous_product_html’ | t }} {% endif %} {% if collection.previous_product and collection.next_product %} | {% endif %} {% if collection.next_product %} {{ ‘products.general.next_product_html’ | t }} {% endif %} </div> {% if settings.product_breadcrumb %} <div class=”breadcrumb_text” itemscope=”” itemtype=”http://schema.org/Breadcrum…”> {{ ‘general.breadcrumbs.home’ | t }} / {% if collection %} {{ collection.title }} {% else %} {{ collections.all.title }} {% endif %} / {{ product.title }} </div> {% endif %} </div></div>{% if settings.product_sidebar %}<div class=”product”> {% include ‘sidebar’ %} </div> <div class=”twelve columns”>Thanks,Jamie Mitchell

  50. Jamie Mitchell

    Hello Emmanuel,I am trying to remove my errors on google merchant, where would you place your JSON LD code in my product liquid? Here is a copy paste of the beginning of my product liquid code,<div class=”sixteen columns”> <div class=”clearfix breadcrumb-collection”> <div class=”nav_arrows breadcrumb_text”> {% if collection.previous_product %} {{ ‘products.general.previous_product_html’ | t }} {% endif %} {% if collection.previous_product and collection.next_product %} | {% endif %} {% if collection.next_product %} {{ ‘products.general.next_product_html’ | t }} {% endif %} </div> {% if settings.product_breadcrumb %} <div class=”breadcrumb_text” itemscope=”” itemtype=”http://schema.org/Breadcrum…”> {{ ‘general.breadcrumbs.home’ | t }} / {% if collection %} {{ collection.title }} {% else %} {{ collections.all.title }} {% endif %} / {{ product.title }} </div> {% endif %} </div></div>{% if settings.product_sidebar %}<div class=”product”> {% include ‘sidebar’ %} </div> <div class=”twelve columns”> <div class=”product-{{ product.id }}”>{% else %} <div class=”sixteen columns”> <div class=”product-{{ product.id }}”>{% endif %}<div class=”section product_section clearfix js-product_section {% if settings.product_images_position == ‘right’ %}align_right–images{% endif %}” itemscope=”” itemtype=”http://schema.org/Product”> <div class=”{% if settings.product_sidebar %}seven{% else %}nine{% endif %} columns {% if product-images == blank %}{% if settings.product_images_position == ‘left’ %}alpha{% else %}omega{% endif %}{% endif %}”> {% include ‘product-images’ %} </div> <div class=”{% if settings.product_sidebar %}five{% else %}seven{% endif %} columns {% if settings.product_images_position == ‘left’ %}omega{% else %}alpha{% endif %}”> {% assign collection_handles = product.collections | map: ‘handle’ %} {% assign variant = product.selected_or_fiThanks,Jamie

    1. Emmanuel Flossie

      Hi Priyanka, The reviews are generated by 3rd party apps, so this can’t be included unless custom code editing. The pricevaliduntil does not exists in Shopify. Please note the code above is designed for Google Merchant Center, and these warnings will not prevent it from working.

  51. Priyanka Shanishchara

    Hi do you know how we can add priceValidUntil, aggregateRating and review data in shopify? Please let know.

  52. Hello, where would you paste your Json ld code?<div class=”sixteen columns”> <div class=”clearfix breadcrumb-collection”> <div class=”nav_arrows breadcrumb_text”> {% if collection.previous_product %} {{ ‘products.general.previous_product_html’ | t }} {% endif %} {% if collection.previous_product and collection.next_product %} | {% endif %} {% if collection.next_product %} {{ ‘products.general.next_product_html’ | t }} {% endif %} </div> <script type=”application/ld json”>{ “@context”: “http://schema.org/”, “@type”: “Product”, “name”: “{{ product.title }}”, “sku”: “{{ product.variants.first.sku }}”, “gtin14”: “{{ product.variants.first.barcode }}”, “brand”: “{{ product.vendor }}”, “description”: “{{ product.description | strip_html | escape }}”, “image”: “https:{{ product.featured_image.src | img_url: ‘grande’ }}”, “offers”: {“@type”: “Offer”,”priceCurrency”: “{{ shop.currency }}”,”price”: “{{ product.price |money_without_currency | strip_html }}”,”itemCondition” : “http://schema.org/NewCondition”,”availability” : “{% if product.available == true %}http://schema.org/InStock{% else %}http://schema.org/OutOfStock{% endif %}”,”url” : “{{ shop.url }}{{ product.url }}”}}</script> {% if settings.product_breadcrumb %} <div class=”breadcrumb_text” itemscope=”” itemtype=”http://schema.org/Breadcrum…”> {{ ‘general.breadcrumbs.home’ | t }} / {% if collection %} {{ collection.title }} {% else %} {{ collections.all.title }} {% endif %} /ThanksJamie Mitchellwww.mitchell-made.com

  53. MicroDataChallenged

    I used the JSON-LD code in my Shopify site in order to link my pixel to Facebook Catalogs, but I keep getting a Facebook error stating that the id is missing. I tried inserting @id into the code using a few variants (#site, URL, etc.) please help.

    1. This code is only designed to follow Google Merchant Center requirement, not Facebook. I recommend you hire a web developer who knows what the requirements are for Facebook. Hope this helps.

  54. Hello Emmanuel,

    I’m trying to add microdata to shopify for Google Merchant. I’ve read your guide, I’ve paste the code into my product.liquid, in my procuct.liquid there isn’t {% include ‘product’ %} so I’ve pasted it under the only one line I’ve got :

    {% section “product” %} .

    I try to verify if it works correctly with Google’s structured data testing tool , I copied the product url and I’ve pasted it into the box, I’ve clicked test it, but google provide me one error :

    name —> you have to specify a value for the name (as you can see in the screenshoot I attached you here).

    How can I solve it?

    Also google display my product price as 27000 EUR while the correct price is 270EUR or 270,00EUR.

    Please help me to solve it.

    Thank you in advance.

  55. Getting “micro data for condition error” on products in Merchant Center. This is occurring even though I added feed army schema code months ago. Looks like I might be having some duplicate code problems. I say that because I also found the attached original Shopify code in the product.liquid file. What do I have to get rid of/change to solve the problem? Here is a link to one such product – https://www.majorsafety.com/products/bw-honeywell-cg-q58-4-calibration-gas https://uploads.disquscdn.com/images/450eeba7852b644898d105e4d608d43864b54ff81f74204cfa9e039e9504c0f9.png

    1. Hello Oddin, I recommend you remove all itemprop, itemscope and itemtype from the html elements that was in your original code. And keep the one supplied in this tutorial.

      You want to change the below

      BW Honeywell CG-Q58-4 Quad Mix Calibration Gas


      Regular price


      $195.00

      to

      BW Honeywell CG-Q58-4 Quad Mix Calibration Gas


      Regular price


      $195.00

    1. Hello Vijay, thanks. It looks like you have added the microdata, I would remove one of the itemscopes saying name in the second listing. As you should only have 1 product set, currently you have two. This can confuse Google in not picking up the right one. You can verify what is seen in the link below. https://search.google.com/structured-data/testing-tool/u/0/#url=https%3A%2F%2Fshopved.myshopify.com%2Fcollections%2Ffrontpage%2Fproducts%2Fproduct-1

  56. Hello Emmanuel, thanks for publishing this useful article. Appreciate it! I don’t have {% include ‘product’ %} as my first line instead I have this {% include ‘sca_freegift_price’ with product %}

    I’m guessing I have to copy and paste your code on the top of the product.liquid file just above the {% include ‘sca_freegift_price’ with product %}. Right?

    As you mentioned to delete existing old scheme data to avoid duplicate, which one of the lines in the screenshot should I delete? I sorry if my queries are amateur-like. I’m not that experience in dealing with codes. Thanks for your help.

    https://uploads.disquscdn.com/images/995b3323ed9a3ea33e18c8a51807bd35a1fed32e0633aecafbc7986d95d546f2.jpg

    1. Hello Sarah, you will need to paste the code underneath {% include ‘sca_freegift_price’ with product %}

      From the screenshot I could not identify what you need to delete. As deleting the lines, requires you to understand html coding. If that is not the case than I recommend to ask your Web developer to assist you or you can hire me ->[email protected]

      But pasting my code underneath {% include ‘sca_freegift_price’ with product %} will be correct, but might cause conflicts with the original microdata.

      Let me know if I can assist you any further.

  57. Hello. I want to know in which line of the product.liquid file should i added . Should i add it to the first line or post the last line

    1. Hello, I have updated step 5 to better explain this. If you have on the first line {% include ‘product’ %} than paste the code after this line of code, if this is not present paste it anywhere at the top and click on Preview to make sure nothing went wrong and than Save

          1. This is the message i got from my google ad person. Please review and suggest

            Hi Shashank,

            Please have look on below active code on the website. This
            code has incomplete information.

            Please make changes according to the code mentioned
            below.

            MPN is product id & price must be in the
            same way as i mentioned in above code

  58. Hello, I submitted the update and received two errors on the validation page, shown below. I copied and saved the code at the bottom of my product liquid page, but the screenshot has it listed on line 2. Is that where it needs to saved? Thanks for your help.

    currency:
    {{ shop.currency }}
    price:
    {{ product.price | money |strip_html }}

    1. Hello zoso, I have indeed pasted the code on line two, because for the example template that is the last line in the product.liquid page. I can’t see your screenshot, so not sure what errors you are having. Can you send me an email [email protected] and I will have a look. Send me your website and a page where the code is pasted so I can have a look at the source code.

        1. Im getting the same error for price. Every product is different so should I add USD? Google is not telling me how to correct it.

          1. The price value can not contain any currency, only numeric numbers ie: the price. If you have the same error as above you need to Fetch URL not copy past the code as this is incorrect way of testing. Go to structured data testing tool and validate with your landing page. Let me know if you continue to have an issue.

          2. Ty. I fetched my url and no errors however, I have NO micro date on my site. I’m using the Google shopping app in shopify to send products to my merchant center and eliminating the Google spreadsheet bc it’s to time consuming and often has errors. So from what I read in my diagnostics in merchant center I now need Micro data?! So confused. Working days on this!

          3. For the microdata you can disable this function in Google Merchant under Settings > Automated Update. As for your constant errors within Google Merchant I might suggest using my application which simplifies the whole process. You can have a look in our demo here > https://feedarmy.com/demo/

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.