Adding a rating aggregate to your abandoned cart emails will dynamically pull in product star ratings.
Once you have completed the following instructions, you’ll see your product star ratings appear under the product title in your abandoned cart emails.
Enable your Klaviyo Feed
Open your Okendo app
Click "Settings"
Click "Integrations"
Click the pencil icon next to Klaviyo
Turn on the "Enable Product Review Aggregate Feed" toggle
Click "Save"
⚠️ Note: Once enabled, allow up to 24 hours for your feed to be populated before continuing.
Add the Product Review Aggregate Feed
Navigate to your Data Feeds in Klaviyo and add a new web feed using the below:
Feed URL: Copy this from your Okendo app
Required name: product_review_aggregate
Request Method: GET
Content Type: JSON
Use the Data Feed in your Abandoned Cart Flow
Open your abandoned cart flow in Klaviyo and go to the email editor for your abandoned cart email.
💡 Tip: If your abandoned cart emails are already live, add a new variation of your email so that you can make edits without affecting the live email. You can use this help article to learn how to create an additional variation.
Click the Data Feeds Settings button and select your new web feed - product_review_aggregate - then click save.
Adding Star Rating Under Product Title
Select the product block, where the product’s from the cart will populate. The example below is within the Shopify Abandoned Cart Reminder Flow.
On your left panel, select "Rows" > "Data Source" and confirm that you are using the correct “Row Collection” and “Row Alias”.
Row Collection: event.extra.line_items
Row Alias: item
On that same left panel, select "Column 2" > "Source" then paste the below snippet of code under an existing Quantity <p> tag.
{% with product=item.product %}
{% with productId=item.product.id|slugify %}
{% for value in feeds.product_review_aggregate %}
{% if productId == value.product_id %}
<table cellpadding="0" cellspacing="0" style="border:0;">
<tbody>
<tr>
<td style="padding-top:2px;padding-right:2px"><img height="14" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/stars/stars-{% widthratio value.rating 1 10 %}-000000.png" style="height:14px;" /></td>
<td>
<p style="padding-top:1px;padding-left:2px;font-size:14px;">{{ value.count }} {% if value.count > 1 %} Reviews {% endif %}{% if value.count == 1 %} Review {% endif %}</p>
</td>
</tr>
</tbody>
</table>
{% endif %}
{% endfor %}
{% endwith %}
{% endwith %}
⚠️ Note: If you are not using the Shopify abandoned cart flow template, you are using a static block, and/or your “Row Collection” and “Row Alias” are different from the above, you’ll need to use the below custom event snippet of code.
{% with productId=event.ProductID|slugify %} {% for value in feeds.product_review_aggregate %} {% if productId == value.product_id %}
<table cellpadding="0" cellspacing="0" style="border:0;">
<tbody>
<tr>
<td style="padding-top:2px;padding-right:2px"><img height="14" src="https://d3hw6dc1ow8pp2.cloudfront.net/emails/review/stars/stars-{% widthratio value.rating 1 10 %}-000000.png" style="height:14px;" /></td>
<td>
<p style="padding-top:1px;padding-left:2px;font-size:14px;">{{ value.count }} {% if value.count > 1 %} Reviews {% endif %}{% if value.count == 1 %} Review {% endif %}</p>
</td>
</tr>
</tbody>
</table>
{% endif %} {% endfor %} {% endwith %}