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

Tourist
9 0 0

Hi, I'm having similar issues on several products. I'm using the Shopify Minimal Theme. Not sure how to fix it. TIA

 

Google Errors.png

0 Likes
Excursionist
32 0 3

Shopify has still not fixed this it seems... 

 

@tobi 

0 Likes
Shopify Expert
2686 67 681

The problem is that there is no universal easy fix as far as I understand.

Basically, when you output structured data for reviews, you need to refer to the product reviewed.

Before, it was possible to refer to this product as a thing (in terms of schema.org)which did not require any properties except for name and that's what the app did.

 

Lately, Google required it to be a product (again, in terms of schema.org), and product requires a lot of properties not output by the App (and it's not supposed to output 'em) -- therefore the fix implemented by Shopify does not fix it :(

 

Now, if your page uses microdata and html generated by review is nested inside this microdata-marked html of the product page, it's possible to simply omit the reference to a product in review code and it will be parsed just fine, as review microdata becomes a part of product microdata simply be nesting. This is what my solution (offered above) does.

 

However, there are themes which use JSON-LD to output structured data (Debut for example), and it's not possible to create a "link" between this data and microdata-formatted  App output.

 

So I guess, it's time to add a checkbox to the App configuration whether it should output microdata-formatted  code for nesting inside the microdata-formatted html of the product page, or JSON-LD formatted output for linking using the @id attribute for themes which use JSON-LD.

 

Another problem is that most of this information is stored in a product metafield, which was only updated as new reviews were added, so even if/when shopify will change the App, it would not automatically update this data :(

 

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
1 Like
Excursionist
32 0 3

Ok, I guess I just have to try to fix this myself.... pretty sad, took me forever to customise the app for my store and now this. 

 

I'll try to find out now whether my theme uses JSON-LD or not. If not I guess I'd try to implement your fix... 

 

Thanks!

 

 

 

0 Likes
Shopify Expert
2686 67 681

Actually, for JSON-LD you can actually parse the metafield and pull necessary data from it, like so:

,"aggregateRating": {
"@type": "AggregateRating",
"ratingCount": {{ product.metafields.spr.reviews | split: 'reviewCount" content="' | last | split: '"' |first | plus: 0 }},
"ratingValue": {{ product.metafields.spr.reviews | split: 'ratingValue" content="' | last | split: '"' |first | plus: 0 }}
}
Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
0 Likes
Excursionist
32 0 3

I think this would be the way to do it for me. - I'm not using any SEO app like 'Smart SEO'. 

Still not sure if my theme (Boost) uses json-ld but think not as I can see the <div class="spr-summary" itemscope itemprop="aggregateRating" itemtype="http://schema.org/AggregateRating"> line in google's structured data testing tool.

 

Where in the (Shopify) code do I perform the adjustment? I don't see anything related in the product-template.liquid...

 

 


@tim wrote:

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>

 

 


 

0 Likes
Shopify Expert
2686 67 681

SmartSEO actually uses code similar to what I've shared.

The code you see in SDTT is output by reviews App and not an indication of what your theme does.

Boost seems to be using JSON-LD, can't tell where it's output (probably in product.liquid template) -- look for 

<script type="application/ld+json">

to find out.

 

To add review data to your JSON-LD, use the code snippet from my latest reply, plus you'd need to remove microdata formatting from SPR html. To do so:

1) remove {{ product.metafields.spr.reviews }} from the code you used to add reviews:

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

So it becomes an empty div.

2)  Use the following code to remove microdata from the reviews html added by javascript

<script>
  // --tim: make Shopify Product Reviews remove all properties from their microdata markup as we use JSON-LD
  var SPRCallbacks = {
    onProductLoad: function( e ) {
      $('[itemprop="itemreviewed"]').remove();
      $('[itemprop="itemReviewed"]').remove();  
      $('.spr-container [itemprop]').removeAttr('itemtype').removeAttr('itemprop');
    },
    onReviewsLoad: function( e) {
     // debugger;
      $('.spr-container [itemprop]').removeAttr('itemtype').removeAttr('itemprop');
    }
  }                
</script>  

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
1 Like
Excursionist
32 0 3

I do see  <script type="application/json" data-product-json> on multiple places.

 

...I think the fix is too complicated for me + I'm not sure if I want it be done anyway. I'm afraid a future update would require again to 'adjust things back' or something like that.

 

I guess when they finally do update the app (I'm sending 'em an e-mail prompting them to do so) I will have to re-post my customer's reviews...

 

Thanks for all the help. If I absolutely need this I'll message you.

 

Tom

0 Likes
Shopify Expert
2686 67 681

Well, 

it does not have to be hard-coded -- it's possible to add a checkbox to theme configuration, like "Apply Tim's fix for Product reviews" :)

So you can always revert to original code by unchecking it.

 

I would not expect the fix quickly -- as I said, it's complicated.

However, even when fixed,  it may take weeks (rather months) for Google to validate the fix, unfortunately and your products will be penalised  untlil it's finished...

One shop where I've applied my fix about a month ago -- validation is "looking good", but still 10 pending out of 21!

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
0 Likes
New Member
5 0 0

Hey, i'm having a very similar issue but I don't use the apps this post is mentioning.  Can someone look at the post I just made and help out if time is permitting?


Thanks in advance

0 Likes