Klaviyo Setup on Shopify

Home » Shopify Tutorials » Klaviyo Setup on Shopify

Set Up klaviyo on Shopify with Cart Abandoned Email Automation

Klaviyo is an email marketing automation tool which can be set up on your Shopify website.

Klaviyo (https://www.klaviyo.com) is most suitable for new small businesses (including Shopify stores) starting email marketing automation for the first time.

Klaviyo provides a visual workflow builder, a drag-and-drop email creator and an intuitive platform.

Shopify store owners can use the analytics, integration and segmentation capabilities to target very specific groups (of contacts).


200+ Free Traffic Sources – The Complete List
Promote Your Website with Free Traffic
Get the Complete List as a PDF Document

Klaviyo Free plan

Start with signing up a free plan on Klaviyo. With a free plan, you can have up to 250 contacts.

You need to comply with the following:

  • The contacts need to go through double opt-in.
  • You are allowed to send up to 500 emails.

Only after you’ve grown your contacts over 250 and you are to contiune using Klaviyo, you will have to upgrade your Klaviyo account to a higher plan.

In a paid plan, you can start sending unlimited emails. The only restriction is the number of contacts you can have. Examples are:

  • For $20 per month, you get to do email marketing (and marketing automation) on up to 400 contacts.
  • $100 per month for up to 3,330 contacts
  • $1,700 per month for up to 146,000 contacts


You can check it on the pricing page (https://www.klaviyo.com/pricing). Toggle the “number of contacts” to see different prices.

Klaviyo Features

Integration with Shopify: Your Shopify integration requires only one click.

The visual flow design lets you create, target, measure and optimize automated email series through mostly the drag-and-drop builder.

Use the email editor to build your own emails from scratch without any coding, or choose from a selection of mobile-friendly email templates.

The automations library provides pre-built workflows including welcome emails, abandoned carts messages, browse abandonment, and more.

Your marketing automation can be based on behavior, shopping history, or custom attributes.

You are not limited to only importing your own contact lists. Grow your list through Facebook/Instagram targeting.

Dynamic coupons let your Shopify store protect against promo code abuse.

Get reports not only on opens and clicks, but how many sales that are generated through the standard email campaigns and/or automated emails.

Always run A/B testing through using different email subject lines, different email content, etc, and have the A/B tests integrated with automated emails and/or workflows.

Set up Klaviyo on Shopify

The setup options

To set up Klaviyo on Shopify, you can go through one of the following options:

  • Add Klaviyo App from the Shopify App Store.
  • From the Klaviyo “getting started wizard”, add the Klaviyo App.
  • Add the Shopify integration from the Integrations tab in your Klaviyo account.

Start Shopify integration

Let’s go for the third option: “Add the Shopify integration from the Integrations tab in your Klaviyo account”.

In your Klaviyo account, go to the Integrations tab. Click the Shopify integration. You will be taken to your Shopify Integration settings page.


Enter your Shopify website URL.

Check the “Subscribe customers who Accept Marketing to a Klaviyo list” checkbox, so the following users will go in your mailing list:

  • People who have purchased from your Shopify store, and at the checkout they have accepted you sending them marketing materials.
  • People who have signed up on your website, but may not have purchased anything.

Select a List that all the email addresses should go into (e.g. Newsletter).

Check the “Automatically add Klaviyo onsite javascript (recommended)” checkbox, so the Klaviyo code will be automatically added to your Shopify website.

Click “Connect to Shopify”, and you’ll be taken to your Shopify account.

Install app


Click “Install App” to synchronize your Shopify data with Klaviyo.

This will take you to your Klaviyo account.

Add Klaviyo Tracking Code (Manually)

If you have not checked the “Automatically add Klaviyo onsite javascript (recommended)” checkbox during the Shopify integration, you’ll have to manually add the tracking code.

Get the “API_KEY” from your Klaviyo account that is specific to your account. Replace the “API_KEY” in the tracking code below.


This is the klaviyo tracking code that must be added to your Shopify website.

In your Shopify account, go to “Online Store”, “Themes”. Click “Edit Code”.

Search for the “theme.liquid file” in the search box.


Add the code in the body section of the theme.liquid file, and click Save.

Enable Cart Abandonment Flow

On many Shopify website (and many other online stores), users abandoned shopping carts. The reasons for cart abandonment may be the users were distracted when they are about to complete the purchases, or they did not have the details of their credit cards (or they couldn’t login to their PayPal accounts).

A properly set up Shopify website would have lost up to 70% revenue because of shopping cart abandonment.

Abandoned cart emails are a single email or a sequence of emails (in a campaign) that are sent to the user who has added an item to his/her shopping cart, but has failed to complete the purchase.

With Klaviyo, you can set up abandoned cart emails.

Revenue Increase Example (with Calculation)

Imagine your Shopify website would have 70 out of 100 abandoned cart users. But when you’ve enabled Klaviyo’s Abandoned Cart flow, it would have retrieved 50% of the potentially abandoned cart users.

Assume each user would produce US$ 100 revenue on average.

Without enabling the abandoned cart flow, only 30 (out of 100) users would have completed their purchases which would produce 30×100 = US$ 3,000 revenue.

After enabling the abandoned cart flow, 30+35 (out of 100) users would have ended up purchasing which would produce 65×100 = US$ 6,500 revenue.

You would have re-gained 116.67% increase in revenue (i.e. (6,500-3,000)/3,000 x 100%).

How Klaviyo’s Cart Abandoned Flow is Triggered?

The default Abandoned Cart flow in Klaviyo starts tracking when a user enters checkout.

When a user enters checkout, it may mean:

  • This user has placed an order and completed a purchase, or
  • The user has added an item to the shopping cart but has not completed the purchase which is considered an abandoned cart.

All the people who have entered the checkout and have completed the purchase would have been skipped due to “failing Flow Filters”, and they will not receive any abandoned cart emails.

Usually your cart abandoned flow has multiple emails. Before each email is sent (to a user), Klaviyo will check the Flow Filters.

For example, when a user has completed a purchase after receiving the first cart abandoned email, he/she will not receive the second email (or any other emails) in the series.

Only the users who has abandoned the checkout without completing the purchase will get all the emails.

How Many Cart Abandoned Emails to Send?

The best practice is to keep the number of emails to 2 or 3.

When to Send Cart Abandoned Emails?

The best practice is to start sending the first abandoned email 1-4 hours after the user has abandoned the shopping cart.

Display Cart Abandoned Items in Emails

Klaviyo allows personalization in the abandoned cart emails.

You may include the information of the specific item that a user has abandoned in the content of your abandoned cart emails that you’re sending to him/her.


The item specific personalized email will contain a dynamic content block and go-to-cart button.

  • The content block enables the inclusion of of an image, link, and/or other information of the specific item in the email.
  • The go-to-cart button will take the user back to the shopping cart with a single click.

By default, the content block will pull in all the items in which the user has left in his/her shopping cart.

You can update the content block to limit the number of items to display.

Optimize Open Rate and Click Through Rate

Open rate and clickthrough rate are two metrics that can be optimized for any email campaign.

Open rate can be influenced by different email subject lines, and different email sending time.

Clickthrough rate is contributed by how many times the receivers have clicked the links in the emails. The common factors affecting the clicking of links include:

  • The call-to-action button (ie. whether the link is a plain hyperlink, a button image, etc)
  • The call-to-action messages
  • The email format (i.e. whether the email is plain text or rich text)
  • The email template layout
  • The actual offer

A/B Testing Examples

Conditional split and/or trigger split

In Klaviyo, you can set up and run conditional split or trigger split against all the above attributes to optimize your open rate and clickthrough rate metrics.

Conditional split and trigger split are A/B tests in Klaviyo’s email automation.

Purchasers vs. non purchasers

Set up conditional split for purchasers vs. non purchasers.


Local users vs. international users.

Set up conditional split for local users vs. international users.


Other elements to A/B test using trigger split may include cart value and cart size.

Cart value i.e. Larger cart value


For users who have placed an item with a relative large cart value, you can send them a different message.

An example is when a user has placed an item which is 5 times larger than the average order value of all your other customers, you may send an discount (or gift) to encourage this user to complete the purchase.

Start with a Trigger Split to the top of the flow.

Assume the average order value is $100. Configure the split to be based on Checkout started value that is less than $500.

All the carts that are worth below $500 will follow the Yes path.

All other larger than five times the average order value will flow down the No path.

Cart size i.e. 5 or more


Similarly, you may want to branch your Abandoned Cart flow based on the number of items someone has in their cart.

An example is you may offer a user who has 5 or more items in his/her cart a buy one get one free or other similar promotion/offer to encourage this user to complete the purchase (or even add more items to the cart).

Start with a Trigger Split to the top of the flow and set it up based on Item Count is less than 5.

All users with fewer than 5 items will flow down the Yes path.

All other users with at least 5 items will flow down the No path.

Create Unique Coupon Codes for Shopify Websites

With a coupon, you can offer your contacts discount to a specific product.

Use coupon codes (that you can generate in Klaviyo) to reduce the number of Shopify cart abandoned users.

Normally you would create a coupon code per promotion or per campaign that can be shared across all users. But this leaves you not being able to restrict the number of users who may use the coupon.

Klaviyo offers the ability to create a unique coupon code for each contact in your list. With a unique coupon code assigned to each user, you will have full control of the maximum number of users who are eligible for the coupon (or discount).

  • You can add only one unique coupon code per email.
  • Each coupon code is for one-time use.
  • The unique coupon code can automatically be sent to each contact as an email, when they appear to have abandoned the shopping cart.
  • Each coupon should be associated per campaign or per workflow (i.e. flow).

Create a new coupon

Go to Coupons tab. Click the “Add Coupon” button.


For each coupon you are creating in Klaviyo, you can specify the coupon name, prefix, discount type, minimum order subtotal, activation date, and expiration date.

Use a coupon in a campaign

For a campaign (created in Klaviyo), you may have two options.

  • Specify an expiration date for your coupon. When a coupon reaches its specified expiration date, all the generated coupon codes associated with the coupon will expire.
  • Leave your coupon to be valid permanently (without specifying any expiry date).

Generate coupon codes for a campaign

Assume your campaign has a fixed expiration date for the coupon (i.e. not a variable expiration date).

Before scheduling your new campaign, you will have to specify the number of coupon codes that Klaviyo should generate.

Click the dropdown menu and select “Add Codes”.


Enter the number of codes Klaviyo will need to generate.

For example, when you enter 500 (under “How many discount codes do you want to create?”), it will show “1 minute” next to “Estimated time to create”.

  • When you have a large email campaign (i.e. a large number of email recipients) , Klaviyo will have to generate a large number of coupon codes. You will have to allow time (i.e. sometimes a few hours) for Klaviyo to generate all the codes.
  • Ideally you should generate at least as many coupon codes as your expected email recipients.
  • When you happen to have generated fewer codes than the number of recipients, you will not be able to schedule the campaign.
  • When your campaign is configured to “Determine recipients at send time”, but the actual number of recipients is greater than the number of codes Klaviyo would generate at “send time”, the email will not be sent to some expected email recipients.

Add coupon tag to HTML email template

Add the coupon tag in the email template of your campaign.

{% coupon_code ‘NAME_OF_YOUR_COUPON’ %}

Remember you can only add one coupon code per email.

Use a coupon in a flow email

It is simpler to send a coupon code in a flow email.

For flow emails, you may:

  • Specify an expiration date for your coupon.
  • Specify how many days or hours all the generated codes of the coupon will expire.
  • Leave your coupon to be valid permanently (without specifying any expiry date).

To use a coupon in a flow email, you will not have to specify the number of codes to be generated.

When your flow email is about to send, Shopify will dynamically generate a coupon code and will add the dynamically generated code to your email.

  • You must connect your flow email to an email list.
  • When you have chosen to use a variable expiration date, flow email will not be available.
  • Any coupon that you have created in a Klaviyo campaign cannot be used in a Klaviyo workflow (i.e. flow email).

Articles on Shopify Tutorials