{% if product.reviews.size > 0 %}
{% assign review = product.reviews.first %}
{% assign author = review.author %}
{% assign datePublished = review.created_at | date: "%Y-%m-%d" %}
{% assign reviewRatingValue = review.rating %}
{% assign bestRating = 5 %}
{% assign worstRating = 1 %}
{% endif %}
Topic summary
Main topic: Improving a Shopify Liquid snippet to generate Product schema markup that includes review data.
-
A Liquid code example was shared that, when a product has reviews, assigns variables from the first review: author, datePublished, rating value, and sets best/worst rating (5/1). This is intended to feed structured data (Product schema) for search engines.
-
Recent update: A participant uses the Trustpilot app for reviews and requests an edited version of the snippet compatible with Trustpilot so it can be used in their store.
-
Key terms: Liquid is Shopify’s templating language; Product schema markup is structured data that helps search engines understand product and review information; Trustpilot is a third-party reviews platform.
-
Status: No solution or code adaptation for Trustpilot has been provided yet; the request remains open.
-
Next steps sought: Guidance or a revised snippet that integrates Trustpilot-provided review data into the Product schema markup.
i am using trust pilot app for reviews and ratings.can you please edit the code for trustpilot app so i can use in ny store.and help will be really appreciated.