skip to Main Content

I want to display how many people leave feedback and the rating number for a product on every product row on the collection page, home page or any within product loop with the shopify Product Review App.

But I can’t find any way to do it.

Can anyone please give me any suggestion, how can I do this?

2

Answers


  1. Chosen as BEST ANSWER

    Finally, I'm able to display how many people rating for a product. Here is the code

    {% if product.metafields.spr.reviews %}
    
          {% capture review_data %}{{ product.metafields.spr.reviews }}{% endcapture %}
    
          {% if review_data contains '"votes"' %}
              {% assign keyword = '"votes"' %}
          {% else  %}
              {% assign keyword = '"reviewCount"' %}
          {% endif %}
    
          {% assign rd_a1 = review_data | split: keyword %} 
      {% assign rd_a2 = rd_a1[1] | split: "=" %}
          {% assign rd_a3 = rd_a2[1] | split: '"' %}
          {% assign product__reviews-count = rd_a3[1] | plus: 1 | minus: 1 %}
    
    {% endif %}
    {{ product__reviews-count }}
    

  2. I did it in this way

    "ratingCount":"{{ product.metafields.spr.reviews | split:'"reviewCount": "' | last | split: '",' | first | plus : 0}}"

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search