Shopify: Installing the Yotpo Star Rating on Product Pages
- DarkLight
Shopify: Installing the Yotpo Star Rating on Product Pages
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
The Yotpo Star Rating presents an aggregated Star Rating for your products.
Installing the Star Rating is a slightly more complex process than installing the regular widget, because it is up to you where to place it.
Installing Star Rating on Shopify
The instructions below are for Shopify's default settings.
- Go to your Shopify Themes menu.
- Click Actions > Edit Code.
- Locate the file that you use for your product pages. This is usually called product-template.liquid or main-product.liquid.
- Paste the following code into the file.
- If you're using Shopify Online Store 2.0, paste the code under the <div class="product__info-wrapper grid__item"> element
- If you're using an older theme, paste the code under the {{ product.title }} element
<div class="yotpo bottomLine"
data-product-id="{{ product.id }}">
</div>
5. Click Save.
Please note:
- The data-product-id attribute only supports alphanumeric (a...z, A...Z, 0...9) and "_" and "-" symbols
- The {{product.id}} variable might differ from theme to theme
Installing Star Rating on Shopify (sites using the "Clean" theme)
- Go to the template editor and look for a file named "product-list-repeatable-item.liquid" it's located at the snippet folder
- Locate the following line in that file:
<p class="title"><a href="{{ producturl }}">{{ product-list-repeatable-item.title }}</a></p> - Add the following code after that line:
{%unless template contains 'product'%}
{% include 'yotpoBottomLine' with product-list-repeatable-item %}
{%endunless'%}
Centering the Star Rating on Product Pages
The Star Rating is aligned to the left by default. If your product description is centered, you may want to center the Star Rating as well.
If you would like the Star Rating to be centered, please use the following code instead:
<div style="text-align: center">
<div class="yotpo bottomLine" style="display:inline-block"
data-product-id="{{ product.id }}">
</div>
</div>
After implementing the code, it should look like this:
Was this article helpful?