How To Add Structured Data to Shopify for Google Merchant Center

How To Add Structured Data to Shopify for Google Merchant Center

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.

There are two versions of the code, the free version on this page, and the paid version. You can view the differences in version by clicking on the link below.

Google Rich Snippet Results

Free Version

Requirements

  • Google Merchant Center > Products > All Products
  • Access to Shopify > Theme > product.liquid or
  • Add it to your theme.liquid file body tag

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.

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.

FeedArmy Edit Structured Data Config
  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
  3. For RETURNS (fa_return_days), add how many days you offer returns. In the below code, I have added 28, change this to the max days you offer returns.
    • You can disable this by setting fa_returns to false.
    • If you already have returns setup in Google Merchant Center, disable the structured data setup by setting fa_returns to false.
    • The returns policy is set to free returns via post.
  4. For SHIPPING, set your shipping currency, which threshold your free shipping is and what your shipping fee is if the merchant does not reach the minimum item cost.
    • You can disable this by setting fa_shipping false.
    • If you already have shipping setup in Google Merchant Center, disable the structured data setup by setting fa_shipping to false.
    • Add the min and max handling and shipping time.

The Code

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

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

<!-- ALPHA2 CODE 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 = 'US' -%}

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

<!-- RETURNS How long is your returns policy in days? -->
{%- assign fa_return_days = 28 -%}

<!-- SHIPPING How much do customer need to spend for free returns, assign your currency? -->
{% if cart.currency.iso_code == 'USD' %}
    {%- assign fa_shipping_currency = "USD" -%}
    {% if fa_product_price >= "75" %}
        {%- assign fa_shipping_price = 0.00 -%}
    {%- else -%}
        {%- assign fa_shipping_price = 4.50 -%}
    {%- endif -%}
{%- endif -%}
{%- assign fa_shipping_handling_time_min = 0 -%}
{%- assign fa_shipping_handling_time_max = 1 -%}
{%- assign fa_shipping_shipping_time_min = 2 -%}
{%- assign fa_shipping_shipping_time_max = 5 -%}

<!-- Disable / Enable shipping or returns true for enabled, false for disabled-->
{%- assign fa_returns = 'true' -%}
{%- assign fa_shipping = 'true' -%}

<!-- 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 -%}

{%- 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 == 'JPY' or cart.currency.iso_code == 'AUD' or cart.currency.iso_code == 'AED' or cart.currency.iso_code == 'CAD' 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' or cart.currency.iso_code == 'BHD' -%}
{%- 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",
  "@id": {{ canonical_url | json }},
  "name": "{{ product.title | strip_html | escape }}",
  "url": "{{ shop.url }}{{ product.url }}",
  "sku": "{{fa_product_id_value}}",
  {%- if product.variants.first.barcode.size >= 12 and product.variants.first.barcode.size <= 14 -%}
  "gtin": {{ product.variants.first.barcode }},
  {%- endif -%}
  "productID": "{{ product.id }}",
  "brand": {
    "@type": "Brand",
    "name": "{{ product.vendor | escape }}"
  },
  "description": {{ product.description | strip_html | json }},
  "image": "https:{{ product.featured_image.src | img_url: '1500x1500' }}",
  {%- if product.variants -%}
    "offers":
      {
        "@type" : "Offer",
        {%- if fa_returns == 'true' -%}
        "hasMerchantReturnPolicy": {
          "@type": "MerchantReturnPolicy",
          "applicableCountry": "{{ fa_product_id_alpha2_code }}",
          "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",
          "merchantReturnDays": {{ fa_return_days }},
          "returnMethod": "https://schema.org/ReturnByMail",
          "returnFees": "https://schema.org/FreeReturn"
        },
        {%- endif -%}
        {%- if fa_shipping == 'true' -%}
        "shippingDetails": {
          "@type": "OfferShippingDetails",
          {% if fa_shipping_price %}
          "shippingRate": {
              "@type": "MonetaryAmount",
              "value": {{ fa_shipping_price }},
              "currency": "{{ fa_shipping_currency }}"
          },
          "weight":{
              "@type": "QuantitativeValue",
              "value" : "{{ product.variants.first.weight | weight_with_unit }}"
          },
          {%- endif -%}
          "shippingDestination": {
            "@type": "DefinedRegion",
            "addressCountry": "{{ fa_product_id_alpha2_code }}"
          },
          "deliveryTime": {
            "@type": "ShippingDeliveryTime",
            "handlingTime": {
              "@type": "QuantitativeValue",
              "minValue": {{fa_shipping_handling_time_min}},
              "maxValue": {{fa_shipping_handling_time_max}},
              "unitCode": "DAY"
            },
            "transitTime": {
              "@type": "QuantitativeValue",
              "minValue": {{fa_shipping_shipping_time_min}},
              "maxValue": {{fa_shipping_shipping_time_max}},
              "unitCode": "DAY"
            }
          }
        },
        {%- endif -%}
        "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: '1500x1500' }}",
            {%- 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 and fa_current_variant.barcode.size <= 14 -%}
              "gtin": {{ product.variants.first.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 2023 Version 3.22 -->

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.

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
Edit Shopify Theme Code
  1. Click on Templates > product.liquid
    • If you are using Dawn 2.0 or you don’t have product.liquid, install the code on Layout > theme.liquid, inside the <body> tag.
Shopify Product Liquid File
  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>
  1. Checking the results

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.

You may also see other warnings. If you have not added all the values in Shopify, the most common missing values are Brand and GTIN. If you want these to show, make sure that you add Vendor and Barcodes in Shopify.

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 use the paid version.

Google Structured Data Testing Result

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
Shopify Edit 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 %}
Social Meta Tags Liquid Pricing Issue

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 == 'JPY' or cart.currency.iso_code == 'AUD' or cart.currency.iso_code == 'AED' or cart.currency.iso_code == 'CAD' 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' or cart.currency.iso_code == 'BHD' -%}
    {%- 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 }}">
    <meta property="og:availability" content="{% if fa_current_variant.available %}instock{% else %}outofstock{% endif %}">
{% endif %}

It should look like the image below.

Shopify Opengraph correct pricing

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

Change Log

  • V3.22 – 13 December 2023: Fixed a spelling error
  • 29 November 2023: Updated OpenGraph to include availability
  • V3.21 – 13 November 2023: Added hasMerchantReturnPolicy and shippingDetails
  • V3.18 – 15 November 2022: Added GTIN empty check
  • V3.15 – 19 October 2022: Removed individual GTIN attributes (gtin12,gtin13,gtin14) and replaced it with gtin for all values
  • V3.14 – 07 October 2022: Changed image URL from Grande to 1500×1500 pixels
  • V3.13 – 01 October 2022: Added Bahrain currency detection
  • V3.12 – 12 June 2022: Removed GTIN validation due to scenarios where numeric values are provided as strings
  • V3.11 – 14 April 2022: Added extra GTIN validation
  • V3.10 – 15 February 2022: Added @id value
  • V3.09 – 01 December 2021: Added AED currency detection
  • V3.08 – 09 October 2021: Added Canadian currency detection
  • V3.07 – 04 October 2021: Updated Brand attribute
  • 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

Premium (Paid)

You can contact us, to arrange a paid version. If you like to compare the free vs paid.

The paid version includes:

  •  Product Details
  •  Shipping Details
  •  Return Policy
  • Auto Currency Detection
  •  Reviews (full list below)
  •  Variant Details
  •  Breadcrumbs
  •  Free Installation Service
  •  Free Updates For All V4.01 – V4.99

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

Subscribe
Notify of
guest
233 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Paul
3 months ago

After installing the latest version of the code I’m seeing a large number of products in my Google Search console with the following error:

Unparsable structured data
Incorrect value type
Items with this issue are invalid. Invalid items are not eligible for Google Search’s rich results

cam
cam
4 months ago

hey thanks for this script, it’s been great and I’ve been using this for a few years! Just noticed after I installed 3.18 that I got this error on certain products :

“additionalProperty”: [{
“@type”: “PropertyValue”,
“propertyID”: “item_group_id”,
“value”: “7073296318622”
}]Liquid error (sections/template–product line 99): comparison of String with 0 failed}
</script><!– Copyright FeedArmy 2022 Version 3.18 –>

I have reverted to v3.12 (the last version I was using) and the error no longer occurs.

Unsure what the underlying reason is, but it may be something that needs addressing.

Apart from this minor thing, keep up the great work!

Himanshu Agarwal
5 months ago

Hi, thanks for your post, we are very grateful to you for finding the duplicate brand value which was due to the error in the code of 2 shopify apps, I have fixed it, now my second question is related to “Fix Opengraph”, I Using “Refresh” shopify theme on my website where I am unable to find “social-meta-tags.liquid”. Kindly assist.

Paul
6 months ago

The is a great article, thank you! I recently implemented this and it has fixed some issues but I’m seeing some new ones.

Missing field ‘hasMerchantReturnPolicy’ (in ‘offers’)
Missing field ‘shippingDetails’ (in ‘offers’)
No global identifier provided (e.g. gtin, brand)
Missing field ‘description’

The above warning are affecting most of my products.

Hassan
6 months ago

Will this work all the same if Reviews app is not the Shopify one? i.e. Okendo for example.

Shawn
9 months ago

How do I add metadata for my shopify store. I keep getting an error message that my products are missing ID information. My Facebook store and its catalog are working normally. It’s my instagram shop that is not excepting the metadata I added to the <head> section. I looked through all your repsonses here, but I can’t see how to specifically add the ID information to the metadata. Can you help?

JP
JP
9 months ago

When fixing the Opengraph we noticed that the code we see is a little different in the social.meta_tags…… Instead of {% if template.name == ‘product’ %}
It says

{% if request.page_type == ‘product’ %}

We have already installed the initial structured data code. Which “IF” should we use?

Last edited 9 months ago by JP
waqar
10 months ago

i need your help with this
Missing field “Missing field “priceValidUntil” (in “offers”)” ..I recently noticed that I had about 209 products with 9 warnings each about on Google search console

waqar
Reply to  Emmanuel Flossie
10 months ago

Sure , Please check email

Shawn512
Reply to  waqar
9 months ago

same question

Mike McLaughlin
11 months ago

I definitely need your help with this: “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”
You said to ask, so I’m asking. I’m using the Shopify theme “Craft”, if that helps.

waqar
1 year ago

Missing field “priceValidUntil” (in “offers”) ..I recently noticed that I had about 152 products with 9 warnings each about on Google search console

Boris
Boris
1 year ago

I customized JSON so it shows different currency according to location determined by subdomain.
By the way I need to show price amount according to currency.
Is there any way for that?
Thanks.

Boris
Boris
Reply to  Emmanuel Flossie
1 year ago

Hi Emmanuel!
The price on our product page is changing according to default Shopify currency converter.
As you know it seems not possible to change the price in JSON/LD via API or JavaScript code.

François
François
1 year ago

Thanks for that!

Could you explain why you did:

{%- 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 -%}

Instead of:

 "gtin": {{ fa_current_variant.barcode }},

I searched google, but I don’t get it. 🙂

Dylan
1 year ago

Hello,

The most recent version (3.10) seems to have issues looping through variants.

as an example has 3 variants listed, however it only seems to create an offer for the 1st variant and not the remaining variants.

Mr.Kiddie
2 years ago

Hi, I still having brand type issue in my site. can you check how we can resolve manually?

AM
AM
2 years ago

Hey!

First, thanks for making this available!

I am running Dawn Theme version 2.4.0.

I installed your code “The Code” as instructed, at the top of the “Body” section in “theme.liquid”.

(1) When I run a “Shema Markup Validator” test, it returns results without errors, but it indicates there are two products.

(2) When I test the “Live URL” on Google’s Search Console, it also indicates there are two products. The first product still has all the six errors I had prior to installing “The Code” and the second product (which I assume is being provided by your code) only has three errors (two of which are related to reviews and I can’t remember the third).

At this point I reverted back to my original “theme.liquid” and thought it’d be best to contact you.

Thanks in advance for any help you can provide, AM.

Hamza Sellak
Hamza Sellak
2 years ago

Hi @EMMANUEL; I’m in exactly the same position as @OMRI; I’m using Dawn 2.0 and I cannot find any of the files you mentioned. Can you please help me as I’ve been running into the “Mismatched value (page crawl) [price]” problems for days and I couldn’t find any solution to this problem. I’d appreciate if you can help me with this. Thanks in advance.

Omri Weiss
2 years ago

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

Jules
Reply to  Emmanuel Flossie
2 years ago

Hello Emmanuel!

Sorry to drop into the conversation, but I think this code may help us resolve the pesky mismatched price warning for variants we are seeing, but we use Loox for reviews. Would it be possible to get assistance with this? You mentioned to comment here if we use a different review system, so I am.

Thanks in advance for any assistance you can provide! 🙂
Jules

Gunnar
2 years ago

Just to let you know, Shopify has included the structured data again in their new Dawn theme and now it appears in the main-product section.

Gunnar
2 years ago

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.

Kenneth
2 years ago

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.

Mehdi Dar
Mehdi Dar
3 years ago

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

Albert Gouws
Albert Gouws
3 years ago

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 }}

Vishesh
Vishesh
3 years ago

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

Diego
Diego
3 years ago

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

Diego
Diego
3 years ago

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?

caapo
caapo
3 years ago

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?

caapo
caapo
Reply to  Emmanuel Flossie
3 years ago

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?

Joost Plas
Joost Plas
3 years ago

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?

Joost Plas
Joost Plas
Reply to  Emmanuel Flossie
3 years ago

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).

Rajan Dimri
Rajan Dimri
3 years ago

Hello,Thanks for this contribution.Currently I’m getting the three errors – https://uploads.disquscdn.c…How can I fix these issues?

Joost Plas
Joost Plas
3 years ago

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?

Joost Plas
Joost Plas
Reply to  Joost Plas
3 years ago

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>

Darcy
Darcy
4 years ago

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

Darcy
Darcy
Reply to  Emmanuel Flossie
4 years ago

Thank you very much! I’m sending you an email right now!Best RegardsDarcy

233
0
Would love your thoughts, please comment.x
()
x