Adding the Reviews Widget via code

Add the Reviews Widget with Liquid code anywhere you can't use app blocks, such as on vintage themes or page builders.

Learn how to manually add the Loox Reviews Widget to your store using liquid code if you can't add it via app block.


When to add the Reviews Widget via code vs. via app block

You might need to add the widget via code if:

  1. you're on a vintage (non 2.0) theme.
  2. you're on a 2.0 theme but want to add the widget in a location where you can't use the Loox app block. For example- if you want to add the widget to a custom snippet, a collection card, or the cart drawer.

If you're on a 2.0 theme and have the option to do so in the location you want, use the Loox Reviews Widget app block instead - it's easier to customize, and it's the only way for AI assistants to read your reviews. Read more about adding widgets via app block.


Adding the widget via custom liquid block

Before adding the widget via liquid code, check if your theme supports custom liquid blocks in the location where you're looking to add the widget. This will make it easier for you to access and customize the code.

  1. Inside the Shopify Themes menu, click Edit theme:
    Shopify Themes page with the Edit theme button highlighted
  2. Head to the page you're looking to work on and click the + in your desired location on the left-hand sidebar. Search for Custom Liquid. If it appears, select this option.
    Shopify theme editor Add section search with Custom Liquid selected
  3. Next, add the following code snippet to the section's Liquid Code:
    <div id="looxReviews" data-product-id="{{product.id}}" class="loox-reviews-default">{{ product.metafields.loox.reviews }}</div>

If you don't have the option to use a custom liquid section in the spot you're looking to add the widget, follow the instructions below on how to add the widget via liquid code.


To manually add the Reviews Widget via code

  1. Inside the Shopify Themes menu, click the ... button next to “Edit theme” and select Edit code:

    Shopify Themes page with Edit code selected from the menu next to Edit theme

  2. Open the template or section where you want to add the widget (for product pages, the file is usually called: product.liquid / product-template.liquid / product-page.liquid / product-main.liquid).
  3. Copy the line of code below and paste it where you would like the widget to appear:
    <div id="looxReviews" data-product-id="{{product.id}}" class="loox-reviews-default">{{ product.metafields.loox.reviews }}</div>

    Shopify code editor with the Reviews Widget code pasted into the product template

  4. Click Save:

    Shopify code editor with the Save button highlighted after adding the Reviews Widget code

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article

Have more questions? Contact support

Still need a hand?

Our support team is available 24/7.