Solved

Exclude products from abandoned cart emails

  • 13 February 2021
  • 31 replies
  • 6145 views

Userlevel 1
Badge +2

Hello!

I am wondering if it is possible to exclude certain items from the dynamic table block for the abandoned cart e-mails. Or only include certain items/ collections. These are items that are “in” their cart but I do not want to send them to encourage them to finish checking out. For example I have the cloverly app for offsetting carbon footprint for shipping and I also have an app that I use to have multiple options for products. I don’t want these items showing in the abandoned cart e-mail. Is there a way to go about excluding these?

Thanks so much for any help!

Natalie

 

 

 

icon

Best answer by retention 15 February 2021, 17:42

View original

31 replies

@retention Thanks for providing your solution. I wanted to know if you could help me make your solution work when combined with the code I added to the dynamic AC block image to unpublish out of stock items. Here’s the documentation I followed: https://help.klaviyo.com/hc/en-us/articles/115005253188

When I follow your solution I am successfully able to remove the product text from showing in a preview. But since I have the “unpublish out of stock” code in the text block where the image block once was, I’m not sure where to add your code to make it work. Here’s what my AC dynamic block looks like: 

Hope this makes sense. Thanks!

Hello,

Is there a way to exclude a product by using the URL of the product (or part of it) in the code?

Thank you

Hey great Community, 
 

I have the same issue with excluding our “Shipping Insurance” from Klaviyo abandoned cart emails. I changed the codes provided in this conversation before: 

 

{% if not 'ac_exclude' in item.product.tags %}
<h3><!--StartFragment--></h3>
<h3><a href="{{ organization.url }}products/{{ item.product.handle }}">{{ item.product.title }}</a></h3>
<h3><!--EndFragment--></h3>
<p>Anzahl : {{ item.quantity|floatformat:0 }} &mdash; Total: {% currency_format item.line_price|striptags|floatformat:2 %}</p>
{% endif %}

 

and changed the image to the provided dynamic variables: 

 

{% if not 'ac_exclude' in item.product.tags %}{% if item.product.variant.images.0.src %}{{item.product.variant.images.0.src}}{%else%}{{item.product.images.0.src|missing_product_image}}{%endif%}{%endif%}


It worked fine that the product is not included anymore but all orders what had included the “Insurance” have now the product name with this small sample image on the left bottom under the normal images. I have absolutely no idea how to remove that? Can anybody help me out? Thanks so much!!

 

 

Userlevel 7
Badge +60

Hey @bill_wishgarden 

So glad to hear it worked for you!

Are you able to apply this coding to SMS text messages for AC too?
And I am guessing the code works for Browse Abandonment Flows as well?

 

Please advise.

 

Brynn

Badge +1

@retention this is super useful, is there any way we can add multiple tags in the if statement? 

I tried adding “ or ‘tag2’ “ but that does not work obviously… Or maybe are other product attributes than tags we can use this in this statement like if the product belongs to a collection? I also tried item.product.collection and iten.product.collections but that did not work either.

 

{% if 'tag1' or ‘tag2’ in item.product.tags %}

code

{% endif %}

 

A million thanks in advance!

Userlevel 1
Badge +3

@stephen.trumble, thanks for that, I totally missed it earlier in the thread.

I implemented the code and everything worked perfectly. Thanks!

Userlevel 7
Badge +60

Hey @bill_wishgarden 

Thank you for following up on this topic.

As @retention mention in his first response, for the image part, you need to wrap the existing snippet, in a new “IF” statement that should look like this:

{% if not 'ac_exclude' in item.product.tags %}{% if item.product.variant.images.0.src %}{{item.product.variant.images.0.src}}{%else%}{{item.product.images.0.src|missing_product_image}}{%endif%}{%endif%}

Hope this helps!

Userlevel 1
Badge +3

@alex.hong or @David To, in my Abandoned Cart email, I have a dynamic table; the left column is the product image and the right column is the product details (price, reviews, quantity, etc). I’m able to successfully hide the product detail from the right column (since I can add the “hide” code snippet), but I cannot hide the product image associated with that product.

Any ideas on how to hide the product image as well?


Thanks!

Userlevel 7
Badge +58

Hi @AlexW ,

Let me see if this helps. While we do sync variants and their images to the catalog in Klaviyo they aren't accessible via a Product Feed. I'm afraid there isn't a specific configuration example but I can provide you with our documentation for how to utilize a feed in Klaviyo and can then work backwards from there: https://help.klaviyo.com/hc/en-us/articles/360033046811-Add-a-Custom-Web-Feed-to-a-Flow-Email

There are a few different ways you could set this up but the high level overview is to take a piece of identifying product information from the event data in your flow (e.g. variant ID or variant color) and look that up in the web feed. The corresponding record in the webfeed would contain an array of other product variants of the same color which could then be used to populate some images/links in your email template. Because this array of products with the matching color would likely also contain the original product being looked up you'd want to also include the product ID for each entry in the array so you could add some logic in your template to exclude the original product that was purchased.

Badge

I have a similar issue where I need to exclude products variants but you can’t tag variants in Shopify. How would one adapt the code to exclude based on the variant name?

Userlevel 7
Badge +60

Hey @kellysandberg,

Are you sure you’re putting those codes in the source code of the text box? A lot of times I see customers mistakenly add code directly into the text box instead of the source code which is visible to recipients. 

David

Badge +2

I tried following the code above but I couldn’t get it to work. Sometimes I got an error that I needed to fix the tags, sometimes I would put the code in and it would display the code text in the preview. I know the previews in Klaviyo wouldn’t show the hidden product because I just added the tag to the product, but I don’t think it should be showing the code text. Can anyone help here? I’m not sure what I’m doing wrong.

Userlevel 7
Badge +60

Hey @ajensen,

I suspect the issue you’re running into may be the syntax you’re using is incorrect. Since the code discussed in this thread relate to the Shopify Checkout Started metric, the syntax would not translate to an email in a flow triggered by BigCommerce’s Started Checkout event. It may be helpful to take a look at some of the resources that were previously provided such as the About Using Event Variables to Personalize Flows and How to Build Dynamic Blocks in a Flow Email Help Center articles to learn how to properly use and pull the correct dynamic syntaxes for your use. 

I think it would also be helpful if you provided the full if/else statement to see if others can lend some advise.

David

Badge +2

I’m on BigCommerce and want to exclude digital products from showing in my abandoned cart email. I tried using {% if not event.extra.line_items.digital_items %} wrapped around the same text you show above but it doesn’t work. Well at least when I try to preview or send myself a preview, I get an error.

 

I also tried wrapping my the text with the name of the product (we only sell 1 digital product) and that didn’t work either. I tried both {% if not event.Items == 'Shipping Protection' %} and {% if not item.product.name == 'Shipping Protection' %} and neither worked.

 

Can anyone help me with this? Much appreciated.

 

Thanks!

Badge

This was very helpful! Thank you for posting a solution.

Badge +5

Dear @David To 

thank you for your reply. 
Of course I used code “in between” that is displayed. 
I contacted your Chat Support yesterday and we do not know why, but after some tweaking, it worked. 
Code was correct.
But it does work now what is most important. 

 

Thank you! 

 

Userlevel 7
Badge +60

Hey @tobias_wildling_shoes,
Just to confirm, are you using the exact code you shared of:

{% if 'ac_exclude' in item.product.tags %} 

{% endif %}

If so, then it seems like you’re missing the response portion of the if-statement. This means that even when this if-statement was true, nothing would be returned since you haven’t defined a response in the statement. My colleague, @Anna McCarthy actually has a great tutorial on using If/Endif/Elif/Else Statements which I’ve included below that I think would be really helpful to take a look at:

If you were using the code provided by @retention verbatim and it worked successfully, I don’t see why removing the not function in the code wouldn’t be working to achieve the inverse effect. Omitting the not from the code would cause those products tagged with ac_exclude to be shown and products without this tag to be hidden. 

David

Badge +5

Dear all, 
I was able to use this great way of excluding certain products from a dynamic block. 

But in my use case it would be more convenient to include certain products. 
I used the code above but like this: 

{% if 'ac_exclude' in item.product.tags %} 

{% endif %}

but it does not seem to work.

What could be the correct code snippet here?

 

Best regards

Tobias

Userlevel 7
Badge +60

Hey @montes,

The solution that’s being discussed in this thread to omit and prevent certain products from being pulled into an email through a dynamic table block would not be the same as using flow filters to exclude users from a flow. 

The difference here is that a flow filter is used to evaluate if an individual is eligible for the flow as a whole. The solution being discussed here would be on a more targeted level of restricting only certain products from appearing in an email. For example, if someone purchased a t-shirt and a baseball cap, if you wanted to omit the baseball cap, using a flow filter will prevent the user from entering the flow as a whole. Recoding the dynamic table block will still allow the customer to enter the flow, but will prevent the baseball cap from appearing in their abandoned cart email. 

David

Badge +3

can this be done with flow filters? 

Userlevel 7
Badge +60

Hey @Zach-LP,

You should be able to accomplish something similar in BigCommerce despite them not using product tags. This would all depend on the if-statement you are create and the variables and values you were evaluating as part of the statement. Instead of using a product tag like you would in Shopify to distinguish these products, you can potentially identify these products within BigCommerce by grouping them in a specific category. 

David

Badge +2

This is amazing thanks so much @retention there a way to exclude like this in BigCommerce since they don’t have product tags like Shopify?

Userlevel 7
Badge +60

Hey @davidbilow,

I would suggest reviewing how you are implementing the code and double checking the variables you are using. Because every store’s integration may be slightly different, some adjustments may be required to achieve the solution posed by @retention in a seamless manner. 

In addition, Route Shipping has a similar solution where instead of evaluating products based on their category, they dictate which products to hide in the dynamic table block through evaluating if a product has a specific title. In their How do I exclude Route from Klaviyo? article they explain how to hide a products whose title equals Route Package Protection' from appearing. Their strategy is also a viable option which can be adjusted to hide specific products which you can customize for use with your own setup if you wish as well. 

Furthermore, because Outlook uses Microsoft Word as their rendering engine for HTML, emails rendering differently than what is designed within an email builder is a known issue explained in he My Email Looks Different When Viewed in Microsoft Outlook Help Center article.

Have a great day!

David

Badge +2

@retention @david.to @ali_luxeAC I was successful with hiding the text, however, I’m experiencing the same issue as you did, @ali_luxeAC , where the image block is visible (but the image itself is hidden). In the previewer it’s an empty box. In an emailed version it is still a link to the product.

So instead of an image block, I used a text block and coded in the image. This hides it appropriately, but the images are huge in an outlook email.

Any ideas anyone?

Thanks!

Reply