Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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
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 -%}
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
Hi Mugilicutti,
did you ever get a solution/answer to this as Im struggling with the same situation.
Regards
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025