Skip to main content



I am triggering an event "custom_checkout_started" in klaviyo when any user tries to purchase an item in my website. The event contains a property cart_id which is id of cart being processed. Also in the event i pass profile property "cart_ids" which is array of cart id which the user has discarded. If user completes the payment, the user profile will be updated in klaviyo where the cart id will be removed from cart_ids array. And in the flow i want to add a condition in filter to send the email only if payment is not completed(i.e if the cart_id in event is present in cart_ids property of profile). How do i check that condition? just came to know that we cannot the use the event property dynamically. ex. event.properties.cart_id or something like that. is in cart_ids

alternately i tried another approach, i created a list and whenever user starts checkout i trigger profile create api and subscription api which adds the user to the created list. i passed property “payment_status” as pending. i pass cart_url  as another property to access discarded cart from email template.

i created a flow which gets triggered when user gets added to the above list and after certain multiple time delay, before sending email i checked profile property “payment_status” if its pending than sent the reminder email else remove the user from the list and so on. this continues for sending 2 further emails after certain delay.

when user completes the payment i update user profile  property “payment_status” to complete so no further emails are sent.

but there may be a scenario. suppose i discard a cart, than a flow will start for me.. and after getting first email reminder i discard another cart , so it will again hit profile create/update api and subscription api. since  i am already in list the flow won’t be triggered but  the cart_link will be updated. hence the remaining two emails from flow one will have  updated cart_link.. and no new flow will be created for this discarded cart.

 

myquestion

whenever another cart or mutiple carts are discarded by the same user when flow1 is in progress , i want to stop the currently running flow and start a new flow. how do i achieve it

or

using event flow how do i compare the cart_id with cart_ids so that i could prevent sending emails.

Hi ​@devendra - thanks for your question, here is how I’d approach this. Klaviyo doesn’t natively allow a flow to terminate based on a different event or a new flow starting, but you can simulate this behavior with a few tactics:

1. Use cart_id as a flow filter

  • At the start of your flow, set a flow filter that checks: Properties about someone > cart_id > equals > scart_id from event]
  • This ensures each flow instance is tied to that specific cart and prevents overlap.

2. Use a custom profile property for last_cart_id

  • When a new custom_checkout_started event is triggered, update a profile property like last_cart_id using Klaviyo’s Track & Identify API.
  • In the flow, add a conditional split: Profile Property > last_cart_id > equals > event.cart_id
  • If false, exit the flow to prevent emails for an old cart.

3. Consider webhook-triggered logic

  • Use an external webhook to update the user’s profile when a new cart is abandoned.

  • Terminate the previous flow by excluding users where last_cart_id != event.cart_id.


Hi ​@devendra I believe the only sensible solution to your problem is if you leveraged the Custom Objects functionality which is something you will have to inquire your account manager if it could be added to your account.  Below are documentation details on how it works:

https://help.klaviyo.com/hc/en-us/articles/35105337172123

https://help.klaviyo.com/hc/en-us/articles/35146374047515

The idea is that you define carts as a Custom Object and it will have a Status property and then in your flows you could use a conditional split using object data as described here: https://help.klaviyo.com/hc/en-us/articles/35146374047515#h_01JPTG7J0Q63B434Y2KPN9NE5Q


@zack

Hi ​@devendra - thanks for your question, here is how I’d approach this. Klaviyo doesn’t natively allow a flow to terminate based on a different event or a new flow starting, but you can simulate this behavior with a few tactics:

1. Use cart_id as a flow filter

  • At the start of your flow, set a flow filter that checks: Properties about someone > cart_id > equals > scart_id from event]
  • This ensures each flow instance is tied to that specific cart and prevents overlap.

2. Use a custom profile property for last_cart_id

  • When a new custom_checkout_started event is triggered, update a profile property like last_cart_id using Klaviyo’s Track & Identify API.
  • In the flow, add a conditional split: Profile Property > last_cart_id > equals > event.cart_id
  • If false, exit the flow to prevent emails for an old cart.

3. Consider webhook-triggered logic

  • Use an external webhook to update the user’s profile when a new cart is abandoned.

  • Terminate the previous flow by excluding users where last_cart_id != event.cart_id.

Hi zack, thanks for  your reply, i tried but could not access the event properties dynamically, ex- properties of someone→ last_cart_id “not equlas” EVENT.CART_ID (cannot use it like this, need to provide a static defined value for event.cart_id) .  ex- see below screenshot 

 


Hi ​@devendra I believe the only sensible solution to your problem is if you leveraged the Custom Objects functionality which is something you will have to inquire your account manager if it could be added to your account.  Below are documentation details on how it works:

https://help.klaviyo.com/hc/en-us/articles/35105337172123

https://help.klaviyo.com/hc/en-us/articles/35146374047515

The idea is that you define carts as a Custom Object and it will have a Status property and then in your flows you could use a conditional split using object data as described here: https://help.klaviyo.com/hc/en-us/articles/35146374047515#h_01JPTG7J0Q63B434Y2KPN9NE5Q

HI ​@whereisjad , thanks for your reply. like you mentioned using custom object i can define an object in profile as below { "carts": " { "cart_id": "cart_001", "status": "pending" }, { "cart_id": "cart_002", "status": "completed" }, { "cart_id": "cart_003", "status": "pending" }, { "cart_id": "cart_004", "status": "completed" }, { "cart_id": "cart_005", "status": "pending" } ] };

but since there will be multiple flows running for each  abandoned carts by the same user, how do i identify for which cart_id the current flow is running for? if i could identify that i can check that cart_ids status in the object above. ?? how do i get the current flows cart_id??

 


@devendra have you considered configuring the flow to utilize the "have at least one" condition, allowing the email to consolidate pending items from all carts with a pending status? I believe this approach would enhance the customer experience by reducing the number of emails sent and potentially lowering deliverability costs. 

Regarding the management of parallel flows, I recommend designing the flow as a type that restricts the same profile from entering more than once on a given day. 

What are your thoughts on this solution?


Reply