How to Create Coupon Codes in Magento 2 for Special Offers
You’ve just launched a flash sale, sent a coupon code to 500 customers, and three hours later your inbox is flooded with “the code doesn’t work” emails. Sound familiar?
Most coupon problems aren’t caused by Magento itself. They’re usually the result of rushed setup: missing usage limits, incorrect customer groups, or checkout friction that makes shoppers abandon their carts before applying the discount.
When configured correctly, coupon codes become one of the most effective promotional tools for driving sales, rewarding loyal customers, recovering abandoned carts, and running targeted campaigns such as VIP offers, newsletter sign-ups, or seasonal promotions. In Magento 2, every coupon is powered by a Cart Price Rule that defines who receives the discount, when it applies, and how much customers save.
This guide covers everything: creating a single code, generating in bulk, and auto-applying coupons via link so customers never have to touch a code at all.
How to Create Coupon Codes in Magento 2
Method 1: Create a Specific Coupon Code
One code, one campaign. Use this when you want a single fixed code like SUMMER20 to share across email, banners, or social media — easy to distribute, easy to track.
This method is implemented in the Cart Price Rule settings.
- Go to
Marketing > Promotions > Cart Price Rulesand press the Add New Rule button.
- Set the Name for the rule and add the Description.
- Activate the rule and select the Websites the coupon code.
- Specify the Customer Groups that coupon will work for.
- On the
Rule Informationtab, underGeneral Information, transferCoupontoSpecific Coupon. - Enter the
Coupon Codemanually.
- Limit how many times the coupon can be redeemed in the Uses per Coupon and User per Customer. Leave them empty to set no restriction.
- Uses per Coupon sets the number of times the coupon code is used.
- Uses per Customers sets the number of times the coupon code is used by the same customers.
- If there are many cart price rules at the same time, you should set the active time and priority to manage them better.
- Set a start date and end date for when your Magento coupon code can be used.
- Set the Conditions the shopping cart should meet for the Magento coupon code to be applied.
- Click
Saveto activate the coupon code.
Method 2: Auto-Generate Multiple Coupon Codes
Use this when one code isn’t enough. Loyalty programs, large email campaigns, or any situation where you want each customer to have their own unique code — so they can’t share it or use it twice.
This method is implemented in the Cart Price Rule settings.
- On the
General Informationpage, mark theUse Auto Generationcheckbox to publish a mass of coupon codes after saving the rule.
- Under
Cart Price Rule, chooseManage Coupon Codestab and do the following:
- Set the
Coupons Qtyto the quantity of coupons you want to publish. - Insert the number for the
Code Length, the length excludes the prefix, suffix, or separators. - Select the
Coupon Formatfrom the following types: Alphanumeric, Alphabetical, and Numeric. - Insert the
Code Prefix- the beginning part of the code if needed. - Insert the
Code Sufix- the end part of the code if needed. - Set the
Dash Every X Characterto make the codes easier to read. For example, the number 3 is inserted into that field, the codes will look like: xxx-xxx-xxx. - Click on
Generatebutton to release multiple coupon codes and they are shown on the table below.
Method 3: Apply Coupon Codes Automatically
Sending a code and asking customers to copy-paste it at checkout sounds simple — but most people won’t bother. A better approach: send a link with the coupon already applied. Customers click, land on your store, and the code is filled in automatically.
To do this, install the Mageplaza Better Coupon Code extension, then go to Stores > Configuration > Mageplaza > Better Coupon.
Now that you’ve got a coupon, there are 2 methods to generate a coupon auto-apply link.
Use quick coupon link generator
- Select the rule you have just created above, and the tool will auto-create a quick link for you
- Click on the Copy icon to get the link
Use coupon link builder
- URL field: Enter the base URL that customers will use. The coupon code will be automatically added at the end of this URL.
- URL Style field: Choose the URL format: Parameter (http://example.com/?c=123) or Hash (http://example.com#c=123).
- Prefix field: (Optional) The part between the base URL and the coupon code.
- Coupon field: Enter the coupon code you created in Cart Price Rules.
- Generate button: Click to generate the coupon link. When customers click the link, the coupon code will be automatically applied to their order.
- After you hit that Generate button, the tool will create the coupon link, copy it, and send it to your customers.
Here’s how it looks on the frontend:
Tips to Create Effective Magento 2 Coupon Codes
Limit Usage to Protect Margins
Set both Uses per Coupon and Uses per Customer (Method 1) for high-value discounts. Bulk-generated codes (Method 2) are unique by nature — no extra limits needed.
Combine with Other Promotions
- Free Gifts: Offer a free product when a coupon code is applied above a cart
- Free Shipping Bar: Add a free shipping action to your Cart Price Rule, or use the Free Shipping Bar extension.
- Gift Cards: Allow customers to use a coupon alongside a gift card at checkout.
- Countdown Timer: Allow customers to use a coupon alongside a gift card at checkout.
- Multiple Coupons: Once customers can apply a code in one click, the next step is letting them use more than one. This helps maximize savings and increase conversion. See Magento 2 Multiple Coupons: Boost Sales & Prevent Losses.
Make the Offer Compelling
- 10–15%: regular promotions for existing customers
- 20–25%: win-back campaigns or seasonal sales
- Free shipping: effective for carts near abandonment. See common causes of cart abandonment.
Track Results
Go to Reports > Marketing > Coupons after each campaign to review usage, discount totals, and revenue. To measure recovery performance, pair your coupon campaign with Abandoned Cart Email. By embedding a unique coupon code inside automated cart recovery emails, you can track exactly how many lost orders were recovered and how much discount each campaign cost you.
FAQ
How do I create a coupon code in Magento 2?
Go to Marketing > Promotions > Cart Price Rules, create a new rule, select Specific Coupon, enter your coupon code, and configure the discount conditions.
Why isn’t my Magento 2 coupon code working? Common causes include an inactive rule, an expired coupon, incorrect customer group settings, unmet cart conditions, or usage limits being reached.
Can Magento 2 generate multiple coupon codes at once? Yes. Enable Use Auto Generation in the Cart Price Rule, then use the Manage Coupon Codes tab to generate multiple unique coupon codes.
Can I limit how many times a coupon can be used? Yes. Use Uses per Coupon to limit total redemptions and Uses per Customer to limit how many times each customer can redeem the coupon.
Can Magento 2 automatically apply coupon codes? Magento’s default functionality is limited. To automatically apply coupons through a URL, you can use the Mageplaza Better Coupon
Wrap Up
Implementing coupon codes is one of the most effective marketing methods. It attracts customer attention, motivates them to spend more for bigger discounts, promotes special products, improves loyalty, etc. So, if you haven’t tried this strategy, don’t hesitate anymore. The results might surprise you.