Skip to main content

Add a review block to abandoned cart emails in Klaviyo

Dynamically display your highest-rated product reviews in Klaviyo abandoned cart flows using a web feed and review block code.

Written by Simon Mainwaring

Overview

Reviews from other customers can be the nudge a shopper needs to finish checking out. Add a review block to your Klaviyo abandoned cart emails, and each product in the cart shows its most recent 5-star reviews.

In this example, the review block is the bottom section. To show star ratings under each product title as well, see Add a rating aggregate to abandoned cart emails in Klaviyo.

Abandoned cart email with a review block in the bottom section

Before you begin

🔔 The product top reviews feed is available on the Power plan and above. View pricing.

Connect Klaviyo to Okendo first: see Integrating Klaviyo with Okendo.

⚠️ The review block works in Klaviyo flows only, not campaigns.


Enable your Klaviyo feed in Okendo

  1. Open your Okendo app

  2. Click the pencil icon next to Klaviyo

    Klaviyo integration settings in Okendo with the Product Top Reviews Feed toggle

  3. Turn on the Enable Product Top Reviews Feed toggle

  4. Click Save.

⚠️ It may take up to 24 hours for your feed URL to populate.


Add the product review block data feed

  1. Navigate to your Klaviyo account > Settings > Other > Web Feeds > Add Web Feed.

    Klaviyo Web Feeds page with the Add Web Feed button

  2. Input the following data and click update.

    • Required name: product_reviews

    • Request Method: GET

    • Content-Type: JSON

    Klaviyo Add Web Feed form


Adding the review block

⚠️ If you aren’t using this data source (item.product.title), you’ll need to insert the custom code further down the page.

  1. Drag and drop a new HTML block into your email where you'd like the review block to show.

    HTML block in the Klaviyo editor

  2. Copy the entire code below and paste the code into your source panel, then click source again to save.

{% with maxProductCount=0 maxReviewCountPerProduct=0 starHex='000000' %}
{% for lineItem in event.extra.line_items %}
{% if maxProductCount == 0 or forloop.counter <= maxProductCount %}{% with productId=lineItem.product.id|slugify product=lineItem.product %}
{% for key, reviews in feeds.product_reviews.items %}
{% if productId == key %}
<h4 style="text-align: center;padding-top:20px;">See why others bought {{ product.title }}</h4>
{% for review in reviews %} {% if maxReviewCountPerProduct == 0 or forloop.counter <= maxReviewCountPerProduct%}
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:middle;" width="100%">
<tbody>
<tr>
<td align="center" style="font-size:0px;padding:5px 25px 0px 25px;word-break:break-word;">
<div style="font-family:Century Gothic, sans-serif;font-size:13px;line-height:18px;text-align:center;color:#1d2236;">
<div><img alt="1 Star" height="18" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/star-filled-{{starHex | lower }}.png" style="padding:0 1px" width="20" /> <img alt="2 Stars" height="18" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/star-filled-{{starHex | lower }}.png" style="padding:0 1px" width="20" /> <img alt="3 Stars" height="18" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/star-filled-{{starHex | lower }}.png" style="padding:0 1px" width="20" /> <img alt="4 Stars" height="18" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/star-filled-{{starHex | lower }}.png" style="padding:0 1px" width="20" /> <img alt="5 Stars" height="18" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/star-filled-{{starHex | lower }}.png" style="padding:0 1px" width="20" /></div>
</div>
</td>
</tr>
<tr>
<td align="center" class="align-center" style="font-size:0px;padding:0px 25px 5px 25px;word-break:break-word;">
<div style="font-family:Century Gothic, sans-serif;font-size:18px;font-weight:bold;line-height:22px;text-align:center;color:#1d2236;">{{ review.title }}</div>
</td>
</tr>
<tr>
<td align="center" style="font-size:0px;padding:0 25px 5px 25px;word-break:break-word;" vertical-align="middle">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse:separate;line-height:100%;">
<tbody>
<tr>
<td align="center" role="presentation" style="border:none;cursor:auto;mso-padding-alt:10px 25px;" valign="middle">
<p style="font-size:16px; line-height:16px;">{{ review.body|truncatewords:50 }}</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="center" class="align-center" style="font-size:0px;padding:0 25px 5px 25px;word-break:break-word;">
<div style="font-size:14px;line-height:22px;text-align:center;color:#1d2236;">{{ review.displayName }}</div>
</td>
</tr>
</tbody>
</table>
{% endif %} {% endfor %} {% endif %} {% endfor %} {% endwith %} {% endif %} {% endfor %} {% endwith %}

⚠️ If you aren’t using the standard Data Source (item.product.title) you’ll need to use the below custom event snippet of code.

{% with maxReviewCountPerProduct=0 starHex='000000' %}
{% with productId=event.ProductID|slugify %} {% for key, reviews in feeds.product_reviews.items %} {% if productId == key %}
<h4 style="text-align: center;padding-top:20px;">SEE WHAT OTHERS ARE SAYING</h4>
{% for review in reviews %}{% if maxReviewCountPerProduct == 0 or forloop.counter <= maxReviewCountPerProduct%}
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:middle;" width="100%">
<tbody>
<tr>
<td align="center" style="font-size:0px;padding:5px 25px 0px 25px;word-break:break-word;">
<div style="font-family:Century Gothic, sans-serif;font-size:13px;line-height:18px;text-align:center;color:#1d2236;">
<div><img alt="1 Star" height="18" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/star-filled-{{starHex | lower }}.png" style="padding:0 1px" width="20" /> <img alt="2 Stars" height="18" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/star-filled-{{starHex | lower }}.png" style="padding:0 1px" width="20" /> <img alt="3 Stars" height="18" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/star-filled-{{starHex | lower }}.png" style="padding:0 1px" width="20" /> <img alt="4 Stars" height="18" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/star-filled-{{starHex | lower }}.png" style="padding:0 1px" width="20" /> <img alt="5 Stars" height="18" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/star-filled-{{starHex | lower }}.png" style="padding:0 1px" width="20" /></div>
</div>
</td>
</tr>
<tr>
<td align="center" class="align-center" style="font-size:0px;padding:0px 25px 5px 25px;word-break:break-word;">
<div style="font-family:'Source Sans Pro', Trebuchet MS, sans-serif;font-size:18px;font-weight:bold;line-height:22px;text-align:center;color:#4a4a49;">{{ review.title }}</div>
</td>
</tr>
<tr>
<td align="center" style="font-size:0px;padding:0 25px 5px 25px;word-break:break-word;" vertical-align="middle">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse:separate;line-height:100%;">
<tbody>
<tr>
<td align="center" role="presentation" style="border:none;cursor:auto;mso-padding-alt:10px 25px;" valign="middle">
<p style="font-size:16px; line-height:16px;">{{ review.body|truncatewords:50 }}</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="center" class="align-center" style="font-size:0px;padding:0 25px 15px 25px;word-break:break-word;">
<div style="font-size:14px;line-height:22px;text-align:center;color:#4a4a49;">{{ review.displayName }}</div>
</td>
</tr>
</tbody>
</table>
{% endif %} {% endfor %} {% endif %} {% endfor %} {% endwith %} {% endwith %}

Review block preview in Klaviyo

Klaviyo spacing issue

Klaviyo's Editor will occasionally add extra code that inserts large spaces into the text block.

Large gaps in a Klaviyo review block

To rectify this issue, you'll need to remove <div>&nbsp;</div> from the code.

If there are still spacing issues, contact support@okendo.io and request that they create a ticket to resolve.


Customizations to the review block

The review block offers some degree of customizability that can be done by changing the variables in the first line of the code.

⚠️ Please make sure that there are no spaces between the equal sign and the value. Adding a space will result in a syntax error and Klaviyo will reject the template.


Limit the number of product reviews in the review block

Update this value to control the maximum number of products that show reviews in the block.

Locate “maxProductCount” in the code block. The 0 value is our standard value and will display reviews for up to 5 products in the email.

Changing this value to 1 will display reviews from only the first product in the email. Changing this value to 2 will display reviews from the first 2 products in the email... and so on.


Limit the number of reviews that show per product

Update this value to control the number of reviews that will show per product in the block.

Locate “maxReviewCountPerProduct” in the code block. The 0 value is our standard value and will display the 5 most recent 5-star published reviews per product.

Changing this value to 1 will display only 1 review for each product in the email. Changing this value to 2 will display 2 reviews for each product in the email... and so on.


Change star color

Our standard star color is hex 000000. To change the star color, locate “starHex” in the code block and update your hex value accordingly.

⚠️ Not all hex values have been generated. If you have broken star images:

  1. Log into your Okendo app

  2. Click on emails under mail

  3. Click on review reply (it will not work unless you use this specific template)

  4. Click on styling

  5. Toggle on override global styling

  6. Change the star color to your hex color

  7. Wait for the live preview to update

  8. Preview the email in Klaviyo again.

Review Reply template styling with Override global styling turned on

To insert a review aggregate, please see our help article here.

Did this answer your question?