How To Build Your Klaviyo Abandoned Cart Email

Play Video

One of the pillars of email marketing in eCommerce is your cart abandonment flow. Talk about setting it and forgetting it – once this automation is built, it can be a powerhouse flow. 

Abandoned Cart flow alone can account for a good chunk of your monthly sales that would otherwise be lost once that person leaves your site. But how do you go about getting this built?

Klaviyo’s abandoned cart and browse abandoned flows can seem a bit tricky at first glance. Klaviyo produces the customer’s cart information into Variables (little code snippets) which appear in a string of data that is collected from your site, each with a unique event titles.

But don’t let that intimidate you, I’ll walk you through creating your first abandoned cart email inside of Klaviyo. Let’s go!

Step One – Integration & Metrics

Integration is key to collecting the abandoned cart data coming from your site. Klaviyo luckily integrates with several big name sites like Shopify, WooCommerce, BigCommerce, and more. You’ll want to check here if your site has a native integration. Your site isn’t on the list? Then you’ll need to explore collecting your site’s data via an API.

On top of the integration, you’ll also need to make sure your Klaviyo site tracking code is applied. 

The Abandoned Cart Metric

Once your integration is set, you’ll need to get some test data coming in. On Shopify for example, just proceed to your site like a visitor would and add some items to your cart! Then start to checkout as you normally would, make sure to use your email address, and once you get the final payment/complete order screen – exit the page.

Almost immediately you should see the abandoned cart metric on your email’s profile in Klaviyo.

Abandoned Cart Metric

You got it! Your first set of test data is now populating that you can use to build your abandoned cart email for ALL other customers who abandon. No matter what the person puts in their cart, you’ll be able to dynamically feed that info into an email using the Variables labeled in that test data.

Let’s jump to the flow now!

Step Two – Building Your Flow

How to start your flow is essential in telling Klaviyo what event data you want to include in an email. When you go to create your flow, you can start from scratch or if your integration has it, select from the pre-built one’s Klaviyo provides but let’s pretend we are starting from scratch!

On the left, you’ll select ‘Metric’, in the drop-down you then select the Metric for Abandoned Cart. For Shopify, they call it ‘Checkout Started’ or in BigCommerce ‘Started Checkout’ – it can differ from site to site. If you used an API, you’ll look out for what you labeled that event as.

Flow Triggers

Now let’s plop in an email from the left panel. Let’s jump in using their default Snack templates just as a base.

Now let’s jump into getting the email ready for the data!

Step Three – Email Set-Up

My go-to recommendation for an Abandoned cart email is to use a dynamic table. It is the best way to set an ‘Array’, which is basically telling Klaviyo to repeat something through a common key phrase. So first, go ahead and drop a Table block into your email.

For design purposes, I’m going to remove the Headings and the third Column. Also click ‘Block Styles’ and adjust the Table Cells Border Top to 0 to remove that top line from the table and set Table Cell Vertical Align to Middle (Just personal preference, lol!)

Dynamic Table in Klaviyo

Next we will adjust the Table to Dynamic instead of Static, and then click ‘Data Source’. This information can differ from my own Shopify example depending on your site integration but we need to adjust the Row Collection and Row Alias to fit your data.

To see what information we need to place here, let’s click into ‘Preview’ on the left.

Klaviyo Cart Variables

Click that and you should see your abandoned cart data listed (or a potential customer’s) recent event data. In it, you’ll find a detailed list of the captured data from their cart. Things like the name of the product, price, etc.

Now let’s click on one of the details –

Product Title Variable

When selected, Klaviyo will then produce the variable name for that field. In this example we grabbed, {{ event.extra.line_items.0.title }} which reveals the Title/Name of the item in their cart. 

Let’s go ahead and copy that variable.

Clicking back into the table, let’s go back to the Data Source, and paste in your variable.

We need to basically separate the key pieces of this variable. 

For the Row Collection you’ll just keep the first section of the variable – event.extra.line_items and the Row alias will be item

Data Source Table

We could get really technical but what this basically does is tell Klaviyo what to match and repeat for. This will make sense in a bit!

Now let’s plug in the variables to the actual dynamic table!

Step Four – Plugging in The Dynamic Cart Data

For your table, you could really customize it any way you see fit for your brand but let’s say we definitely want to include the Product Title, Product Image, Product Description, Product Price, and then a button back to their cart.

Let’s go ahead and set the first Column as a photo-only column.

When you click into Column 1, adjust it from a Text Column to an Image Column.

Image Block

In your preview, you’ll find a section that contains the images of the product in their cart. In our cart, we have this variable {{ event.extra.line_items.0.product.images.0.src }}.

I’ll copy that variable and take it back over to Column 1 in our table.

Click ‘Browse’ as if you’d upload an image and on the left, select ‘Placeholder’. Then paste in your product image variable in. We will need to adjust the variable to fit the Data Source we set. Basically, we will trim this variable down.

{{ event.extra.line_items.0.product.images.0.src }} →  {{ item.product.images.0.src }}

You’ll basically remove your Row Collection that we set before ‘event.extra.line_items’ and adjust your alias to match. The reason you’ll remove that first zero is because that zero represents the item # in the cart and since we want this to repeat for each item, we don’t need to bring in that label specific to that first item in the cart. 

BUT you’ll keep that second Zero because that is actually in relation to the product photo number.

Placeholder Image Klaviyo

So if your products on-site always have three photos and you want to default to it over the first photo, your variable would end up something like – {{ item.product.images.2.src }}.

Click Save and click Preview. At the bottom of the data, click ‘Preview Now’. You should not only see the product image coming in but it should be repeating for each item in the person’s cart! (Mine is only one because of the test cart was a single item)

Klaviyo Abandoned Cart

Now let’s plug in the rest of the data.

Moving over to Column 2. You can add in any extra details you want to include for your product.

In this example, I put in:

Klaviyo Dynamic Abandoned Cart

When linking your product image or the title of the product, you have to get a little creative with the dynamic link.

If there isn’t a variable for the product page link, you should have the product handle variable – {{ event.extra.line_items.0.product.handle }}

Which becomes…

{{ item.product.handle }} 

And when plugged into the Link section → https://testsite.com/{{ item.product.handle }}. Just plug in your site link before the handle and it’ll link each item to their product page.

Finally, let’s throw a button under the table.

The great thing about the cart link is that it doesn’t change from item to item – it is static! So you’ll place your button in and for the link you’ll paste in the cart url variable. Which for mine is {{ event.extra.checkout_url }}.

And now you can adjust for formatting, size, etc! But your core template for the table is ready to go!

I always recommend putting your flow into Manual for the first handful of actual abandoned carts to double-check for consistency in the data but once you get flow live – sit back and let it do all the work!

If you need someone to help build your Klaviyo Abandoned Cart email flow, feel free to shoot me an email to talk more!

More To Explore

How to Build a Welcome Email Series

In this blog, we’ll explore the key components of building an effective welcome series that resonates with subscribers and encourages long-term connections. Understanding these fundamentals can drastically improve your email marketing efforts.

Read More »