Fix Shopify Google Snippets Image Error
January 5, 2024
Update: Fix for Shopify Google Snippets Image Error in Stockmart Theme
I’m pleased to announce that I have resolved the issue with Google Snippets image errors in the Stockmart Shopify theme. I have identified a problem with the image URLs in the rich snippets code, and I have replaced it with my custom one for now, fixing the Missing Image error for all products in Merchant Centre (Google Shopping).
As you can imagine this caused some panic for a moment but I stand by my long term understanding of Google's Web Crawlers attempted procedure:
- Try to crawl the web page and read the direct content (this doesn't easily qualify for Google Shopping channel without any form of Rich Snippets if I’m not mistaken);
- If rich snippets are found use those to grab the necessary info and ignore the basic page crawl excluding URL & other SEO purposes.
Anybody currently using the Stockmart theme or another Shopify Theme with minimal or incorrect Rich Snippet Code (Schema) that might be displaying the image URL or other info incorrectly.
This was an issue with the way that the JSON-LD code was formatted for the product images. Our team has corrected this issue, and the images in the Google Snippets are now displaying correctly.
<script type="application/ld+json"> {% if product.images.size > 1 %} {% assign imageList = product.images %} {% else %} {% assign imageList = product.featured_image.src %} {% endif %} { "@context": "https://schema.org/", "@type": "Product", "name" : "{{ product.title }}", "description" : "{{ product.description | strip_html |strip_newlines }}", "image": "{{ product.featured_image.src | img_url: 'grande' }}", "sku": "{{ product.selected_or_first_available_variant.sku }}", "offers": { "@type": "AggregateOffer", "lowPrice": "{{product.price | without_currency}}", "highPrice": "{{ product.compare_at_price_max | without_currency }}", "price":"{{product.price | without_currency}}", "priceCurrency": "ZAR" } } </script> {% if product.metafields.yotpo.reviews_count %} {% assign reviews_average = product.metafields.yotpo.reviews_average %} {% if product.metafields.yotpo.reviews_count > 0 %} <script type="application/ld+json"> { "@context": "http://schema.org/", "@type": "AggregateRating", "url": "{{ shop.url }}{{ product.url }}", "image" : "{{ product.featured_image.src | img_url: 'grande' }}", {% if reviews_average != '0' %} "ratingCount": "{{ reviews_average | round }}", {% endif %} {% if product.metafields.yotpo.reviews_count != '0' %} "reviewCount": "{{ product.metafields.yotpo.reviews_count | round }}", {% endif %} {% if reviews_average > '0' %} "ratingValue": "{{ reviews_average | round }}", {% endif %} "availability" :"http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}", "itemReviewed": { "@type" : "Product", "name" : "{{ product.title }}", "description" : "{{ product.description | strip_html |strip_newlines }}", "offers": { "@type": "AggregateOffer", "lowPrice": "{{product.price | without_currency}}", "highPrice": "{{ product.compare_at_price_max | without_currency }}", "price":"{{product.price | without_currency}}", "priceCurrency": "ZAR" } } } </script> {% endif %} {% else %} {% assign reviews_average = 0 %} {% assign reviews_average = '0' %} {% endif %}
Frequently asked questions
Is this fix specific to the Stockmart theme?
Yes, the original issue was identified and fixed within the Stockmart Shopify theme's JSON-LD code. However, the underlying problem of incorrect rich snippet formatting could affect other Shopify themes with minimal or improperly structured Schema. Check your theme's rich snippet implementation if you see similar errors.
How did the rich snippets image error impact Google Shopping?
The incorrect image URLs in the rich snippets code led to "Missing Image" errors in Merchant Centre. This prevented products from being properly displayed or indexed in Google Shopping, impacting visibility and potential sales. Google prioritizes rich snippets for shopping channels.
What was wrong with the JSON-LD code for product images?
The JSON-LD code was incorrectly formatted specifically for product images, causing Google's crawlers to misinterpret the image URLs. The fix involved replacing the problematic code with a custom implementation that correctly points to
product.featured_image.src | img_url: 'grande'Why does the code use ZAR for priceCurrency?
The
priceCurrency