Set Up Coupons (for Magento 1.x)

Last updated at:


Magento supports Shopping Cart Price Rules that can be used to apply a discount to a customer's order. Coupon codes can be created for existing price rules, so that shoppers can easily leverage a given code to apply a discount during the checkout process.

Klaviyo's Coupons for Magento feature allows Magento 1.0 stores to do the following:

  • Create new coupons in Klaviyo associated with pre-existing price rules in Magento.
  • Include dynamic coupons within flow emails, so each recipient receives a unique code.

This guide will explain how to get setup with Magento coupons in Klaviyo.

Dynamic coupon codes are not currently available when sending campaign emails. Sending unique coupon codes in a campaign would require generating thousands of codes per second. Klaviyo cannot guarantee a specific Magento server's rate-limiting settings will not impact the generation of dynamic coupons at this volume and velocity. Due to this, dynamic coupons are only available when sending flow emails.


As a prerequisite, ensure that you've enabled the Magento integration in Klaviyo and installed the Klaviyo extenstion in Magento.

Enable the REST API

Start by enabling the REST API by creating a new REST Role and giving it full access, then assigning the role to one of your admin users.

  1. Click on System > Web Services > REST - Roles.
  2. Create a new Admin role. For the field Role Name enter a name, for example "Administrator".
  3. Click on the Role API Resources tab on the left. Set Resource Access to All and click Save Role.
  4. Next, navigate to System > Web Services > REST - Attributes.
  5. Select Admin from the list of user types.
  6. Set Resource Access to All and click Save.
  7. Next, navigate to System > Permissions > Users.
  8. Select an admin user from the list and click Edit user.
  9. Click the REST role tab on the left sidebar.
  10. Click the radio button to assign the new REST admin role to your user.
  11. Click Save User.

You've now enabled the REST API for your Magento store.

If you are unsure whether or not your REST API is configured properly, please review the steps outlined in our guide on Troubleshooting Coupons (for Magento 1x).

Generate REST Credentials in Magento

To enable Klaviyo's Magento Coupons feature, first generate REST API credentials from your Magento store using the REST admin account you just made, and then paste these into your Klaviyo account.

  1. Log in as the REST admin user you created in the Enable the REST API section above
  2. Click on System > Configuration and then click on Klaviyo under the Customers section.
  3. Click Generate OAuth Tokens.763276

The Consumer Key, Consumer Secret, Authorization Token and the Authorization Secret will populate. You will copy/paste these values into your Klaviyo account in the next step.

Setup Magento Coupons in Klaviyo

  1. From your Klaviyo account, navigate to your Magento integration.
  2. Click the Advanced Options arrow to expand the Coupon Settings.
  3. Paste in the REST credentials you created above.

    Your Magento server must support HMAC-SHA1 signatures for OAuth authentication.

  4. Click Update Magento Settings.

Klaviyo will validate your REST credentials and you will be able to start creating coupons with the Coupons tab of your account.

Create a Magento Coupon in Klaviyo

When you first navigate to the Coupons tab in your Klaviyo account after providing your REST credentials, you will see the message, "You haven't added any coupons yet." 

Before you create a new coupon, you will first need to define a Price Rule in Magento that will include all the specifications for the coupon. Price Rules cannot be created from within Klaviyo. A new coupon created in Klaviyo must reference a pre-existing Price Rule in Magento.

When creating a Price Rule in Magento, note that the option to associate a new Price Rule with a specific coupon should be left set to Specific Coupon and you must have the Use Auto Generation checkbox selected.
  1. Click Add Coupon to create a new coupon.
  2. Fill in the following information: Coupon Name and the Magento Rule ID.
    • Coupon Name: The name you specify can consist of only letters, numbers and underscores and can be up to 32 characters long
    • Magento Rule ID: Create a rule in Magento first, and paste the ID of that rule here to associate it with this coupon

All created coupons will appear with the following overview details:

  • Coupon Name: Name of the coupon
  • Active Timeframe: There are the following options:
    • Active, No Expiration
    • Date A - No Expiration
    • Date A - Date B
    • Active, Expires Date B
  • Created Date: Date the coupon was created
  • Last Updated Date: Date the coupon was last updated

Coupons can be edited and deleted from this tab via the dropdown on the right-hand side.

Use a Magento Coupon in a Flow Email

Once a coupon is created, you can insert it into a flow email using the following placeholder variable. You can only add one coupon code per email. You can display the same coupon code in multiple places, but you cannot use multiple codes.

{% coupon_code 'CouponName' %}

Replace CouponName with the name of your coupon. For example:


Use Unique Coupons in SMS Flow Messages

Unique coupons are also available for your SMS/MMS messages in flows. Generate the codes just like you would for email. Then, use the template tag below to add the coupon code to your SMS or MMS message:

{% coupon_code 'CouponName' %}.

In the snippet, change CouponName to the name of the coupon you want and add it into the message (either flow or campaign).


Unlike in emails, you can only use one coupon code per SMS message. With email, you have access to hidden blocks to send different coupons based on where someone lives or what they’ve done. If you try to add multiple coupons to an SMS message, you will see an error message.


Was this article helpful?
33 out of 47 found this helpful