Cart Abandonment

Whether you’re an e-commerce company or a product company, the techniques used for cart abandonment can help you increase completion rates in any flow where you have drop off. One of the most powerful concepts you’ll learn is how to store context on a profile for easy recall and personalization later.

How it works

This recipe is slightly technical. We’ll walk through sending cart data to, clearing the cart when someone checks out, setting up rules to trigger a message when a cart has something in it, and personalizing a message with information from their cart data.

When someone has something in their cart, we’ll populate their cart attribute. When a person makes a purchase, we’ll clear their cart attribute. We’ll create a segmentA segment is a group of people in your audience that you want to target with campaigns, messages, etc. You can join groups of people manually, or by attribues and event data. for people who have the cart attribute, and send these people down a campaign reminding people that they still have items in their cart.


  • Your API credentials from your workspace.
  • The ability to update profile data programmatically when items are added and removed from a Person’s cart.


In, you can store two types of information on a Person: attributes and events. A common way people try to do abandoned carts is using events. However, the most flexible way to do it is with attributes and there are few steps:

The Cart

Store the cart data in the Person’s profile

We recommend that you store people’s cart data as an attributeA key-value pair that you associate with a person—like their name, the date they were created in your workspace, etc. Use attributes to target people and personalize messages.. For our examples on this page, we’ll store a person’s cart data in an attribute called cart, and we’ll use the following example cart.

    "cart": [
            "item_name": "Hat", 
            "item_price": "22"
            "item_name": "Scarf",
            "item_price": "11"

Set the “cart” attribute when a person adds or removes items

For this example, we’re sending the data using cURL, but you can use your language of choice to update a person’s “cart” attribute.

curl  -i    -X
PUT    -H "Content-Type: application/json"    -u
your_site_id:your_api_key    -d '{"cart":[{"item_name": "hat",
"item_price":22},{"item_name": "scarf", "item_price":11}]}'

By storing the cart attribute on a person, you’ll be able to use liquidA syntax that supports variables, letting you personalize messages for your audience. For example, if you want to reference a person’s first name, you might use the variable {{customer.first_name}}. to personalize messages for your audience based on the items in their “cart” attribute.

Clear the “cart” attribute when the Person checks out

We’ll trigger our abandonment email by detecting that there’s something in the cart. If there’s nothing in the cart i.e. the person purchased, or otherwise emptied their cart, then we don’t want to send them an email. This removes the cart attribute from a person.

Setting the cart attribute to an empty string removes it from a person’s profile.

curl  -i    -X
PUT    -H "Content-Type: application/json"    -u
your_site_id:your_api_key    -d '{"cart":""}'

Create Your Segment

Create a segment for people who have a cart attribute using the exists condition.

a segment for people who have a cart attribute
a segment for people who have a cart attribute

Then, use this segment as the trigger in a condition-triggered campaign.


People will match this campaign immediately when they add something to the cart. So make sure you add a delay in your workflow that gives customers enough time to check out.

Set up Frequency

On the trigger page, set up your campaign so people will re-enter the campaign every time they match your cart conditions.


Add your delay

You might want to add something like a 45 minute delay before your first email, and delays between your first email and future messages.


You should set your campaign’s exit conditions to make people exit when they stop meeting the trigger conditions. If a person’s cart is empty when we go to send them a message, we won’t send the message and they will exit the campaign. This prevents your campaign from sending messages to your customers if they complete their purchase before the delay ends.

Create your abandonment email

Hi {{customer.first_name}}!

Your cart contains:
{% for item in customer.cart %}{{ item.item_name }} - {{ item.item_price }}{% endfor %}

In our simple example, this will render like the email below.


You can use this basic structure to store lots of data as customer attributes and merge in things like a picture of the item in the cart, a link to the item, etc.

Wrap Up

Abandoned cart campaigns are a great way to think about any workflow where someone doesn’t complete the steps you were hoping they would. If you have any trouble setting this up, ask us for help! Send us an email with a link to your campaign, and we’ll assist you however we can.

Copied to clipboard!