Solved

Exclude products from abandoned cart emails

  • 13 February 2021
  • 18 replies
  • 2074 views

Badge +1

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

18 replies

Userlevel 7
Badge +49

@tangleartistry There is a way, but it requires some coding. It’s actually quite interesting to achieve.

If you have multiple different products that you want to exclude from the dynamic table block, the easiest way to do it is to tag those products in Shopify, and then use that tag to exclude the products.

Let’s say for example you tag them with “ac_exclude”.

Then, in the dynamic table block, you need to wrap the text part (Title, Quantity, Price, etc.) in an “IF” statement that should look like this:

{% if not 'ac_exclude' in item.product.tags %}
<h3><a href="{{ organization.url }}products/{{ item.product.handle }}">{{ item.product.title }}</a></h3>

<p>Quantity: {{ item.quantity|floatformat:0 }} — Total: {% currency_format item.line_price|striptags|floatformat:2 %}</p>
{% endif %}

This will check for each product if “ac_exclude” is one of the tags. If the product doesn’t have the “ac_exclude” tag, it will be shown in the feed.

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 that you’ll succeed in implementing this!

Badge +1

@retention Thank you so much! This worked perfectly. I couldn’t figure it out at first and thought it wasn’t working. Then realized it was because I added the tags to the products, and the preview carts I was using to test were done before the tags were added. Thank you tremendously for taking the time to do this for me :hugging:

 
Userlevel 7
Badge +49

@retention Thank you so much! This worked perfectly. I couldn’t figure it out at first and thought it wasn’t working. Then realized it was because I added the tags to the products, and the preview carts I was using to test were done before the tags were added. Thank you tremendously for taking the time to do this for me :hugging:

 

 

Really glad that you’ve figured out how to implement it. It can be tricky.

Badge +1

@retention This was a life saver. Spent days trying to figure this out. 

Question, what if you wanted to include these types of add on products somewhere else in the email but not as detailed, like maybe just an itemized list of titles? 

Badge

This only partially worked. The coding successfully hid the product names, but (in the preiview) the photos are showing as blank boxes and they are still linked.

**EDIT: it works just fine- I emailed myself a preview instead of previewing in Klaviyo and the flow works correctly. Thanks!

 

 

Userlevel 7
Badge +54

Hey @ali_luxeAC,

So glad you were able to resolve your own issue and highlighting that sending yourself a preview properly hid the product, unlike the Klaviyo previewer! I’m sure this bit of information will help future Community members who may be confused about this as well!

@sleepingdog, if you wanted to include these types of additional products in your email, but with less detail, you can do so by either using a text block or building another dynamic table block while using the opposite rules used to hide these products away. Borrowing @retention’s example, instead of building an if statement to hide these products which has this “ac_exclude” tag, you can build your if statement to instead only display products with this “ac_exclude” tag.

In terms of the format and the details you want to pull in for these additional products, that would depend on what dynamic variables you are using and including. To further understand how dynamic blocks are build and how to customize your emails with event variables, I would suggest taking a look at the About Using Event Variables to Personalize Flows and How to Build Dynamic Blocks in a Flow Email Help Center articles. 

I hope this helps!

David

 

Badge +1

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

Userlevel 7
Badge +54

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

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 +54

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 +1

can this be done with flow filters? 

Userlevel 7
Badge +54

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 +4

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 +54

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 +4

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! 

 

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

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!

Userlevel 7
Badge +54

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

Reply