PRODUCT - Fixing the broken reviews count

When the Shopify Reviews app was enabled on Prestige, we used to extract the review count to show it as part of the tab's title. Unfortunately, starting from January 2020, Shopify has changed the structure of their metafields (the data they store for the review) and removed the ability for us to extract the review count. As a consequence, it now shows 0. Please note that for products that have not received any new reviews since the change, the correct count may still show up, but it will break as soon as a new review is posted.

Fortunately, there is already a way to fix this issue :). Simply follow those steps.

1
In the list of your theme, click on "Actions" then "Edit code":

2
In the list of snippets, click on "product-tabs.liquid" file (the number of files may vary depending on the apps you have installed, but the important is to click on "product-tabs.liquid"):

3

Around the end of the file (it is usually around line 153, but it may varies depending on the custom code you may have added), locate this line:

{%- assign reviews_count = product.metafields.spr.reviews | split: '<meta itemprop="reviewCount" content="' | last | split: '">' | first | times: 1 -%}
	

And replace it by the following code:

{%- if product.metafields.spr.reviews contains 'itemprop="reviewCount"' -%}
     {%- assign reviews_count = product.metafields.spr.reviews | split: '<meta itemprop="reviewCount" content="' | last | split: '">' | first | times: 1 -%}
{%- else -%}
      {%- assign reviews_count = product.metafields.spr.reviews | split: '"reviewCount": "' | last | split: '"' | first | plus: 0 -%}
{%- endif -%}
	
4
Save the file.