Skip to main content

Magento: Adding voucher codes to your rewards

Let LoyaltyLion create your Magento voucher codes automatically, or generate them in Magento and import them yourself

Written by Jason Leader

In this article:


Overview

Voucher rewards on Magento need a supply of discount codes. There are 2 ways to add them:

  • Automatically. We create the codes in your Magento store and keep them topped up. This needs a working API connection to your store.

  • By importing them. You generate the codes in Magento and upload them to your reward. Use this if we can't connect to your store's API.


Adding codes automatically

  1. In LoyaltyLion, go to Program, then Rewards.

  2. Open the actions menu next to your reward, and click Add codes.

  3. On the Add codes (auto top up) tab, enter the number of codes you want available at all times, between 100 and 1,000.

  4. Click Save auto top up options. You'll see "Auto top up options have been updated".

If the auto top up tab is missing, or you see "Auto top-up has been disabled", we can't reach your Magento store. On Magento 2, reauthorize LoyaltyLion in Magento. On Magento 1, see Magento 1: when we can't reach your store.


Importing codes from Magento 2

If we can't connect to your Magento 2 store, generate the codes in Magento and import them into your reward. In this example, we create codes for a €5 reward.

  1. In LoyaltyLion, create or choose the reward you want codes for.

  2. In your Magento admin, go to Marketing, then Cart Price Rules, and click Add New Rule. Set these fields:

    • Websites: the Magento website that matches your loyalty program

    • Customer Groups: every group that should be able to use the reward

    • Coupon: Specific Coupon, with Use Auto Generation selected

    • Uses per Coupon and Uses per Customer: 1

    • From: today's date. Leave To blank

    • Public In RSS Feed: off

  3. Under Actions, set the discount to match your LoyaltyLion reward:

    • Apply: fixed amount or percentage, matching the reward

    • Discount Amount: for a fixed discount, the amount off, such as 5 for €5 off. For a percentage, the percentage, such as 10 for 10% off

    • Discard subsequent rules: on

  4. Save the rule, then generate the number of coupons you need under Manage Coupon Codes.

  5. Export the coupons as a CSV, and delete every column except the coupon code.

  6. In LoyaltyLion, open the actions menu next to your reward, click Add codes, and on the Import codes into LoyaltyLion tab, upload your CSV.


Magento 1: when we can't reach your store

On Magento 1.7 and above, automatic codes need REST API access to your store. If we can't reach it, the most common causes are:

  • Your store isn't on the internet, for example a development store at localhost or 127.0.0.1. Install LoyaltyLion on a store that is publicly accessible.

  • Your store is password protected.

  • Your .htaccess file sends API requests to the wrong place. The API rule must come straight after the index.php rule, and before any other rewrite rules:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^api/rest api.php?type=rest [QSA,L]

Still stuck? Contact support@loyaltylion.com and we'll help.


FAQ

Why can customers use an imported code without meeting my minimum spend?

A minimum spend set in LoyaltyLion only applies to codes we create. Codes you import from Magento follow the rules of the Magento cart price rule they came from, so set the same minimum spend on that rule.

Where can I find LoyaltyLion codes in Magento?

On Magento 1, go to Shopping Cart Price Rules, open the LoyaltyLion price rule, and click Manage Coupon Codes.

Did this answer your question?