Displaying Product Ratings in Google Search Results

Boost organic traffic by displaying your product ratings in search results using Google Rich Snippets.

Rich Snippets are organic search results that include additional information (such as product ratings).


Adding the Rich Snippets code

The Rich Snippets code is how your review data is integrated into Google.

You can verify the integration using Google's structured data testing tool. For products with at least one review, you should see an "aggregateRating" section under the Product object:

Note: Your ratings may not appear on live searches until Google recrawls and reindexes your store's pages, which can take up to several weeks. You can ask Google to recrawl your URLs.


Manually adding the Rich Snippets code

You can manually add the code by following the steps below:

  1. You can verify the integration using Google's structured data testing tool. For products with at least one review, you should see an "aggregateRating" section under the Product object:
  2. Open the template or section you use for product pages (usually called product.liquid or product-template.liquid, but some themes may work differently).
  3. Paste the following code at the bottom of the page:
{% if product.metafields.loox.num_reviews %}
<script id="looxSchemaJson" type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "Product",   
   "@id": {{ canonical_url | json }},   
   "aggregateRating": { 
     "@type": "AggregateRating",      
     "ratingValue": "{{ product.metafields.loox.avg_rating }}",      
     "reviewCount": "{{ product.metafields.loox.num_reviews }}"   
 },   
 "name": {{ product.title | json }}
}
</script>
{% endif %}


Some themes report review data to Google differently. If your theme uses Meta tags, follow these steps instead:

  1. Inside your Shopify Themes menu, click the “...” button next to “Customize” and select "Edit code".
  2. Open the template or section you use for product pages (usually called product.liquid or product-template.liquid, but some themes may work differently).
  3. Click CTRL + F
  4. Search for: http://schema.org/Product
  5. Paste the following code beneath the relevant element (for example: <div itemscope itemtype="http://schema.org/Product">): 
{% if product.metafields.loox.num_reviews %}
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<meta itemprop="ratingValue" content="{{ product.metafields.loox.avg_rating }}"/>
<meta itemprop="ratingCount" content="{{ product.metafields.loox.num_reviews }}"/> 
</div>
{% endif %}

If you need help editing your Liquid code, contact our Support team at [email protected]. We’re available 24/7 and happy to help!

Still need help? Contact Us Contact Us