🔎Displaying Star Ratings on Organic Google Search Results

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:

  1. Create a new snippet called wise-rich-snippet.liquid under snippets folder.

  1. Paste the following code.

snippets/wise-rich-snippet.liquid
{% capture productID %}{{ product.id }}{% endcapture %}

{% if shop.metafields.wisereviews.reviews.value.products[productID].average_rating %}
  <script id="wiseReviewsSchemaJson" type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Product",
      "@id": {{ canonical_url | json }},
      "aggregateRating": {
        "@type": "AggregateRating",
        "ratingValue": "{{ shop.metafields.wisereviews.reviews.value.products[productID].average_rating }}",
        "reviewCount": "{{ shop.metafields.wisereviews.reviews.value.products[productID].reviews_count }}"
      },
      "name": {{ product.title | json }}
    }
  </script>
{% endif %}

  1. Open the template or section you use for product pages (usually called product.liquid, main-product.liquid or product-template.liquid, but some themes may work differently).

{% render 'wise-rich-snippet', product: product %}

  1. Paste the following code at the bottom of the page:

Last updated