Displaying reviews and ratings using Trustreviews metafields

If you would like to display star ratings and/or reviews in certain places in your storefront, you can leverage Shopify metafields and add them in your theme's code.

How to Use TrustReviews Metafields in Your Shopify Theme

TrustReviews offers two standard Shopify metafields that can enhance your online store's product reviews: reviews.rating and reviews.rating_count. These metafields provide valuable information to showcase the average rating and the number of reviews for each product.

Here's how you can use TrustReviews metafields to display this information in your theme code:

Go to your Shopify Admin and navigate to Online Store > Themes.
In the "Current theme" section, click on the "Actions" button and select "Edit Code".
Look for the product.liquid file in the list of files on the left-hand side.
Open the product.liquid file and locate the desired location within the HTML code where you want to display the metafields.

To showcase the average rating, use the following code: {{ product.metafields.reviews.rating.value }}.
This will display the value of the average rating, such as "3.5".

To display the number of reviews, include this code: {{ product.metafields.reviews.rating_count }}.
This will show the total number of reviews, for example, "125".

If you want to highlight the minimum and maximum rating values, you can use the following codes:
To display the minimum rating value: {{ product.metafields.reviews.rating.value.scale_min }}. This will show the minimum value, such as "1.0".
To showcase the maximum rating value: {{ product.metafields.reviews.rating.value.scale_max }}. This will show the maximum value, for example, "5.0".
Remember to insert these codes into the appropriate places within the product.liquid file's HTML code.

Once you have made the necessary changes, click "Save" to save your modifications. To see the results, inspect any product on your store.

If you encounter any difficulties or require further assistance, our support team is here to help. Feel free to reach out to us at support@trustapps.co, and we'll be more than happy to assist you.

Implementing TrustReviews metafields in your theme code is a user-friendly way to showcase valuable information about your product reviews, helping customers make informed purchasing decisions.

Updated on: 03/12/2024

Was this article helpful?

Share your feedback


Thank you!