Skip to main content
Solved

Exclude products from abandoned cart emails

  • February 13, 2021
  • 33 replies
  • 10039 views

Show first post

33 replies

Forum|alt.badge.img+2
  • Contributor I
  • June 7, 2023

@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!


Forum|alt.badge.img
  • Contributor I
  • February 22, 2024

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


stephen.trumble
Forum|alt.badge.img+60

Hey @bill_wishgarden 

So glad to hear it worked for you!


Forum|alt.badge.img
  • Contributor I
  • April 23, 2024

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!!

 

 


Forum|alt.badge.img
  • Contributor I
  • May 23, 2024

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


Forum|alt.badge.img
  • Contributor I
  • June 10, 2024

@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!


Forum|alt.badge.img+3
  • Contributor I
  • October 28, 2024

@retention I tried the code snippet you shared and it seems to work by pulling in the correct URL for the image but it is pulling in the image as a shown below. Any idea how to fix this?

 


Forum|alt.badge.img+3
  • Contributor III
  • June 2, 2025

Could anyone please help with the code, if I’ve already added code under ‘source’ on our Abandon Browse and Abandon checkout flows, to prevent them firing for products that are out of stock (but published, to collect sign ups for our Back in Stock flow).

 

Here is the current code:

<div>{% catalog event.ProductID unpublished="cancel" %} <a href="{{ catalog_item.url }}"><img style="width: 200px;" src="{{ catalog_item.featured_image.full.src }}" width="200px"></a> {% endcatalog %}</div>

 

and I’d ideally like a code which will amalgamate the two, so the above code to exclude OOS products, and also hide ‘hidden’ products?