Solved

Abandoned Carts Email -- How to prevent sending the email if the Cart is deleted?

  • 22 February 2023
  • 8 replies
  • 561 views

Badge +1

I am transitioning from the Shopify integration to the APIs and I will be synching my Carts in the Checkout Started events.

 

When creating flows to send Abandoned Cart emails, I add a link to the cart so the user can complete their purchase. In the backend, I delete carts after a certain amount time to clean up the database.

Is there a way for me to stop sending emails that point to deleted carts?

Seems like there is no record of shopping carts in Klaviyo.

Thanks!

icon

Best answer by saulblum 24 February 2023, 02:24

View original

8 replies

Userlevel 4
Badge +6

Hi Chris, if you’re clearing carts on your end, could you send a custom event to the Klaviyo profile — say, “Cart Deleted” — and then in your abandoned cart flow, check whether the profile has had this event since starting the flow? This way, you could stop the flow from triggering if this custom event came in after the Started Checkout event (or whatever event you’re using for the abandoned cart flow).

Badge +1

@saulblum thanks for responding!

 

Considering that a profile might be able to have multiple carts, I will have the send an custom Cart Deleted event with the id of the cart right? Would that allow me to have 1 generic event with filters for the Abandoned Cart email flow?

Userlevel 4
Badge +6

Multiple carts meaning, say, across multiple browsers?

Regarding passing in the cart ID with this new event, is there some property of the Started Checkout event that would have this same ID? Though, even if there were, we can’t do a flow filter with a dynamic comparison value (e.g. Started Checkout cart ID == Cart Deleted cart ID.

If the Started Checkout event does have a cart ID, one approach could be a profile property that’s an array of currently valid (non-deleted) cart IDs, and in the email itself, there is a way to dynamically cancel an email by doing a catalog lookup on a non-existent product. In the email template, you could check whether the cart ID of Started Checkout event (assuming there’s such a property) is contained in that profile property list (which you would update every time there’s a Started Checkout event and every time you delete a cart), and if not, we can use tagging to cancel the email from being sent.

Userlevel 2
Badge +6

While there is a solution to this, I'm curious as to WHY you have this problem.  Best practice for abandoned cart emails are 1-2 days MAX.  If you are emailing customers weeks afterwards I think you have a scheduling problem not a technical problem.  Keeping your customers carts makes sense for 30-60 days what have you, but you should be sending the abandoned cart email WAY earlier.  Once the abandoned cart email is sent they’ve completed the flow so customer won’t receive any more emails unless you have specified that they do.

As for the technical side, one big adjustment our team needed to make was conceptually understanding how Klaviyo worked.  We came from a solution that was very structured - carts, orders etc. Klaviyo has none of this structure.  You create a cart by creating an event that you’ve identified as a cart event.  You then can submit whatever data you need inside that event.  So the sky is the limit for whatever you want to do there.  

Badge +1

@saulblum thank you for getting back to me!

I like your suggestion. Although is a bit hacky it seems like there are not that many options at the moment to handle this in Klaviyo. Thank you, I will consider it!

 

@cdetdi I see your point, and that makes total sense about sending emails before carts are deleted however I just wanted to prevent the bad experience. Now take a look at this other scenario.

 

What if  the user starts checkout, the event is emitted, but then the user goes back for whatever reason and removes/adds an item to then once again start checkout. This would create 2 Started Checkout events linking to the same cart but with different set of items. There is no way to sort of update the event in Klaviyo. The flow would treat it like the user visited the store twice and would send 2 abandoned cart emails.

 

Userlevel 4
Badge +6

What if  the user starts checkout, the event is emitted, but then the user goes back for whatever reason and removes/adds an item to then once again start checkout. This would create 2 Started Checkout events linking to the same cart but with different set of items. There is no way to sort of update the event in Klaviyo. The flow would treat it like the user visited the store twice and would send 2 abandoned cart emails.

To handle this scenario, you can limit how often a profile enters the flow.

https://help.klaviyo.com/hc/en-us/articles/115002779411-How-to-create-an-abandoned-cart-flow

Another flow filter you might want to add is Hasn't been in flow in the last X days. This will prevent those who recently received your abandoned cart messages from receiving them again within the specified timeframe. 

    1. Click on the trigger.
    2. Choose Flow Filters.
    3. Click the Add a Flow Filter button.
    4. Choose Has not been in this flow.
    5. Select hoursdays, or weeks.
    6. Type the amount of time you want to prevent someone from entering the flow again.
      Flow filter configuration set to 'Has not been in this flow in the last 7 days'
Userlevel 2
Badge +6

What if  the user starts checkout, the event is emitted, but then the user goes back for whatever reason and removes/adds an item to then once again start checkout. This would create 2 Started Checkout events linking to the same cart but with different set of items. There is no way to sort of update the event in Klaviyo. The flow would treat it like the user visited the store twice and would send 2 abandoned cart emails.

To handle this scenario, you can limit how often a profile enters the flow.

https://help.klaviyo.com/hc/en-us/articles/115002779411-How-to-create-an-abandoned-cart-flow

Another flow filter you might want to add is Hasn't been in flow in the last X days. This will prevent those who recently received your abandoned cart messages from receiving them again within the specified timeframe. 

    1. Click on the trigger.
    2. Choose Flow Filters.
    3. Click the Add a Flow Filter button.
    4. Choose Has not been in this flow.
    5. Select hoursdays, or weeks.
    6. Type the amount of time you want to prevent someone from entering the flow again.
      Flow filter configuration set to 'Has not been in this flow in the last 7 days'

 

You’re thinking too ‘old school’ where you’re trying to update the ‘cart’ record in Klaviyo.  There is no such thing.  Its a bit ‘there is no spoon’ but once you understand that it will all make sense.

I would make a tweak to saulblum’s solution above - that solution will cause the most recent cart event to be skipped.  Rather than skip anyone who has not been in the flow, I would *kick* anyone who is already in the flow that way you can put them in. i.e. If a new event occurs which also triggers the same flow the first event gets dropped.  

This is what will happen with this flow filter.  If a customer is already in this flow they’ll get dropepd once the ‘Added to Cart’ event fires.  The ‘Added to Cart’ event itself will insert the customer into the flow anew.

Badge +1

Thanks!! @cdetdi @saulblum 

Reply