Solved

Recently Viewed Item to email for Woocommerce users

  • 9 March 2021
  • 4 replies
  • 201 views

Userlevel 1
Badge +3

Hi! 
I’ve tried to add Recently Viewed Item block on my Abandoned Cart email flow, but it just doesn’t seem to work. 

I’ve tried to do it several different ways. For one, I tried to follow this instruction. All the triggers/info about client’s viewed product runs nicely to the person’s profile list. 

Inside the email itself I used a template, in which I created a Text block. Inserted the Source:

{% for item in person.ViewedItems %}
<table style="display:inline-block; margin-left:auto; margin-right:auto">
    <tbody>
        <tr>
            <td style="padding-right:15px;padding-left:18px; width:50px"><img src="{{ item.ImageThumbnailUrl }}" style="margin: 1px; max-width: 150px; height: auto;" /></td>
        </tr>
        <tr>
            <td style="padding-right: 15px;padding-left:18px; text-align: center; font-size:13px; width:50px; font-weight:800">{{ item.Title }}</td>
        </tr>
        <tr>
            <td style="padding-right: 15px;padding-left:18px; text-align: center;font-size:12px; width:50px"><em>{{ item.Metadata.Price|striptags }}</em></td>
        </tr>
    </tbody>
</table>
{% endfor %}




(Clicked Source again). But still nothing. The block appears in the template and shows all the item.Title, item.Metadata.Price etc. fields, but when I try to preview the template on Klaviyo or send the template as a preview to email, no real item appears in the block. 
Cloud it be, that this particular code is for Shopify and it doesn’t integrate with my Woocommerce platform? Is there any other similar codes for Woocommerce users? 
Thank you in advance! 

icon

Best answer by caroline 11 March 2021, 18:07

View original

4 replies

Userlevel 5
Badge +8

Hi @Liisi,

Is the flow triggered by a Viewed Product event? If not, it’s possible that the customer you’re previewing the email as has not viewed any products; as a result, there’s no data for us to pull into the email. I would recommend previewing the email as a customer that you know has viewed items on your site (or viewing it as yourself after viewing products on your site).

Best,

Caroline

Userlevel 5
Badge +8

Hi @Liisi,

Just wanted to check back in on this -- were you able to confirm whether the flow was triggered by a Viewed Product event?

Best,

Caroline

Userlevel 1
Badge +3

Yes! Got it! :) 
Thanks!

Badge +2

Hi! i’ve implemented the same approach on a campaign (not a flow) and wanted to see if there’s a way in the code that i can skip “out of stock” products.

<table class="KL_custom_product_block" style="table-layout: fixed;" width="100%" align="center">
<tbody>
<tr>{% for item in person.ViewedItems|slice:'2:4' %}{% if item or unpublished %}
<th class="product_mobile2" style="width: 49%; height: auto; float: left;" valign="top" width="49%" height="auto">
<table width="100%" align="center">
<tbody>
<tr>
<th class="mobile" width="100%" height="160">
<p style="text-align: center;" align="center"><a href="{{ item.Url }}" style="font-weight: 200; text-align: center;" target="_blank" rel="noopener"><img class="mobile" style="max-height: 160px; width: auto; height: auto;" src="{{ item.ImageThumbnailUrl }}" alt="{{ item.Title }}" width="auto" height="160" /></a></p>
</th>
</tr>
<tr>
<th class="mobileName" style="padding: 0px 20px;" valign="top" width="100%" height="40">
<p style="text-align: center;" align="center"><span class="font3colName" style="font-size: 13px; font-weight: 200; font-family: Helvetica, Arial, 'sans-serif';">{{ item.Title }}</span></p>
</th>
</tr>
</tbody>
</table>

 

Reply