0
votes

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

2 Answers

2
votes

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
votes

I did it in this way

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