Aug 16, 2023

Update: Fix for Shopify Google Snippets Image Error in Stockmart Theme

If you’ve bought 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 Googles Web Crawlers attempted procedure:

1.Try to crawl the web page and read the direct content ( this doesnt easily qualify for Google Shopping channel without any form of Rich Snippets if i’m not mistaken); 2.If rich snippets are found use those to grab the necesarry info and ignore the basic page crawl excluding url & other SEO purposes.

Anybody current 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 %}