Either "offers", "review", or "aggregateRating" should be specified - Google Error

Tourist
6 0 1

@tim will await your marvelous fix! ;)

0 Likes
New Member
1 0 0

How can we add a review to a product with no reviews?

0 Likes
Shopify Expert
2575 40 602

If your product has no reviews, than it's a warning only, nothing wrong with it.

Here the situation is different -- product has reviews, but the markup is done in a wrong way -- this is an error and should not be ignored.

 

@McGreals -- here is the updated javascript code, using mutationObserver to find when reviews are loaded. Use if assigning SPRCallbacks does not work for you because an App (like StampedIO) overwrites it:

            function watchSPR(mutations, observer) {
              for (m in mutations) {
                var mutation = mutations[m];
                if( mutation.type == "childList" && mutation.addedNodes.length ) {
                  // console.log(mutation.addedNodes);
                  var $m = $(mutation.addedNodes);
                  if( $m.find('.spr-header').length ) {
                    $('[itemprop="itemreviewed"]').remove();
                    $('[itemprop="itemReviewed"]').remove();
                    console.log('SPR Patched');                 
                    
                    setTimeout( function() {
                      observer.disconnect();
                      console.log('Detaching from SPR');
                    }, 1000);
                  } 
                }
              };
            }

            observer.observe(
              document.getElementById('shopify-product-reviews'), 
              {
                childList: true,
                subtree: true
              }
            );

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
1 Like
New Member
1 0 0

Hi there

 

I'm also getting this message about 3 products - but can't see how to fix?

 

Can anyone help?   Its for these 3 url's

 

https://www.spicepots.com/products/bhuna-spice-pot

https://www.spicepots.com/products/korma-spice-pot

https://www.spicepots.com/products/indian-summer-selection

 

Help !

 

 

 

 

0 Likes
Shopify Partner
4 0 1

Thanks Tim - this little snippet resolved a lot of Product errors due to Stamped / Shopify reviews code.

I'm still getting an Error in AggregateRating with missing itemReviewed field which I'm trying to resolve but an uphill battle until Shopify and Stamped fix their code

 

 

0 Likes
Shopify Expert
2575 40 602

Grant, which snippet you've tried -- first one or the second, with MutationObserver?

Mind sharing a link to a product with error?

 

The code I've shared is based on an assumption that page uses schema.org microdata and reviews element is directly inside the Product  itemscope.
I understand that not all shops may fit this and I guess Shopify wanted to support as much use cases as possible, but looks like it's not really an option  anymore?

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
0 Likes
Shopify Partner
4 0 1
<div id="shopify-product-reviews" data-id="{{product.id}}">
{% assign mf = product.metafields.spr.reviews | newline_to_br | split: "<br />" %}
{% for line in mf %}
   {% if line contains "meta" and line contains "itemreviewed" %}
   {% elsif line contains "div" and line contains "http://schema.org/Product" %}
     {% assign skip_div = true %}
   {% elsif skip_div %}
     {% if line contains "/div" %}
       {% assign skip_div = false %}
     {% endif %}
   {% else %}
      {{ line }} 
   {% endif-%}
{% endfor %}
</div>
<script>
  var SPRCallbacks = {
    onProductLoad: function( e ) {
      $('[itemprop="itemreviewed"]').remove();
      $('[itemprop="itemReviewed"]').remove();  
    }
  }                
</script>

The one above Tim.

https://www.twolips.vip/products/bumpps-sebum-control-serum

0 Likes
Shopify Expert
2575 40 602

Ah, I see.

The code works as expected but the problem is that your structured data is output in JSON-LD format and  that solution is not for you, as I mentioned above.

 

(Though you have 2 JSON-LD records for product, one output by Smart SEO and another by FeedArmy :)

 

In your case, I guess it's better to remove the itemtype="http://schema.org/AggregateRating" and metas from the SPR elements, as Smart SEO pulls in this data anyway (and FeedArmy too).

The code can be like this I guess:

 

<div id="shopify-product-reviews" data-id="{{product.id}}">
{% assign mf = product.metafields.spr.reviews | newline_to_br | split: "<br />" %}
{% for line in mf %}
   {% if line contains "<meta" %}
{% elsif line contains 'itemtype="http://schema.org/AggregateRating"' %}
{{ line | remove: 'itemtype="http://schema.org/AggregateRating"' }} {% elsif line contains "div" and line contains "http://schema.org/Product" %} {% assign skip_div = true %} {% elsif skip_div %} {% if line contains "/div" %} {% assign skip_div = false %} {% endif %} {% else %} {{ line }} {% endif-%} {% endfor %} </div> <script> var SPRCallbacks = { onProductLoad: function( e ) { $('.spr-summary').attr('itemType','').find('meta').remove() } } </script>

 

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
0 Likes
Shopify Partner
4 0 1

Thanks Tim for your valuable contributions.

 

Yes removed the Feedarmy script as I was just testing this output Vs the Smart SEO app - have implemented your updated script and new tests show no Errors.

0 Likes
Tourist
3 0 3

@tim Hi Tim , thanks for your solution 

<div id="shopify-product-reviews" data-id="{{product.id}}">
{% assign mf = product.metafields.spr.reviews | newline_to_br | split: "<br />" %}
{% for line in mf %}
   {% if line contains "meta" and line contains "itemreviewed" %}
   {% elsif line contains "div" and line contains "http://schema.org/Product" %}
     {% assign skip_div = true %}
   {% elsif skip_div %}
     {% if line contains "/div" %}
       {% assign skip_div = false %}
     {% endif %}
   {% else %}
      {{ line }} 
   {% endif-%}
{% endfor %}
</div>
<script>
  var SPRCallbacks = {
    onProductLoad: function( e ) {
      $('[itemprop="itemreviewed"]').remove();
      $('[itemprop="itemReviewed"]').remove();  
    }
  }                
</script>

I tried this code, but now I have this error "Missing field 'name'" from Google. 

Any suggestions?

 

0 Likes