Re: Would like to add aggregaterating to shopify store

Would like to add aggregaterating to shopify store

KrisG2
Excursionist
34 1 15

Hi everyone,

I have plenty of reviews on my website, and I would like to add the 'aggregate rating' so these star reviews can be seen in Google search under my organic listings. I'm hoping it will improve our CTR and it's flagged on our Search Console as a missing field.

I'm familiar with the edit-code section and folders on the site, I'm just unsure what code or file I need to update to make this appear... Is this a straightforward thing to do?

Any help would be greatly appreciated! Many thanks in advance.

My website is: The Bespoke Sign House 

Replies 2 (2)

omarhussain
Shopify Partner
32 5 6

you just need to go to theme.liquid 
in head tag put this and you will find the reviews app count and rating variable so just put those here <meta itemprop="ratingValue" content="{{ review_rating }}">
like this
{%- assign review_rating = false -%} {% if product.metafields.spr.reviews %} {% capture review_data %}{{ product.metafields.spr.reviews }}{% endcapture %} {%- assign rating_keyword = '"ratingValue":' -%} {%- assign rd_a1 = review_data | split: rating_keyword -%} {%- assign rd_a2 = rd_a1[1] | split: "," -%} {%- assign rd_a3 = rd_a2[0] | replace: '"', "" -%} {%- assign review_rating = rd_a3 | plus: 1 | minus: 1 -%} {%- assign count_keyword = '"reviewCount":' -%} {%- assign rd_a1 = review_data | split: count_keyword -%} {%- assign rd_a2 = rd_a1[1] | split: "," -%} {%- assign rd_a3 = rd_a2[0] | replace: '"', "" -%} {%- assign review_count = rd_a3 | plus: 1 | minus: 1 -%} {% endif %}
{%- if review_rating %}
<div itemprop="aggregateRating" itemscope="" itemtype="https://schema.org/AggregateRating"> <meta itemprop="ratingValue" content="{{ review_rating }}">
<meta itemprop="reviewCount" content="{{ review_count }}"> </div> {%- endif -%}

mugilicutti
Visitor
1 0 0

hello, I am going to try this but would like to confirm I understand you correctly. under theme.liquid then under <head> I put <meta itemprop="ratingValue" content="{{ review_rating }}">  ?

 

or under  theme.liquid  under <head> I put {%- assign review_rating = false -%} {% if product.metafields.spr.reviews %} {% capture review_data %}{{ product.metafields.spr.reviews }}{% endcapture %} {%- assign rating_keyword = '"ratingValue":' -%} {%- assign rd_a1 = review_data | split: rating_keyword -%} {%- assign rd_a2 = rd_a1[1] | split: "," -%} {%- assign rd_a3 = rd_a2[0] | replace: '"', "" -%} {%- assign review_rating = rd_a3 | plus: 1 | minus: 1 -%} {%- assign count_keyword = '"reviewCount":' -%} {%- assign rd_a1 = review_data | split: count_keyword -%} {%- assign rd_a2 = rd_a1[1] | split: "," -%} {%- assign rd_a3 = rd_a2[0] | replace: '"', "" -%} {%- assign review_count = rd_a3 | plus: 1 | minus: 1 -%} {% endif %}
{%- if review_rating %}
<div itemprop="aggregateRating" itemscope="" itemtype="https://schema.org/AggregateRating"> <meta itemprop="ratingValue" content="{{ review_rating }}">
<meta itemprop="reviewCount" content="{{ review_count }}"> </div> {%- endif -%}  ?

 

thank you in advance