Cookies setting

Cookies help us enhance your experience on our site by storing information about your preferences and interactions. You can customize your cookie settings by choosing which cookies to allow. Please note that disabling certain cookies might impact the functionality and features of our services, such as personalized content and suggestions. Cookie Policy

Cookie Policy
Essential cookies

These cookies are strictly necessary for the site to work and may not be disabled.

Information
Always enabled
Advertising cookies

Advertising cookies deliver ads relevant to your interests, limit ad frequency, and measure ad effectiveness.

Information
Analytics cookies

Analytics cookies collect information and report website usage statistics without personally identifying individual visitors to Google.

Information
mageplaza.com

How to Create Coupon Codes in Magento 2 for Special Offers

Vinh Jacker | 07-03-2026 How to Create Coupon Codes in Magento 2 for Special Offers - Mageplaza

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.

Create a Specific Coupon Code
  • Go to Marketing > Promotions > Cart Price Rules and press the Add New Rule button.
Cart Price Rules
  • 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.
Customer groups
  • On the Rule Information tab, under General Information, transfer Coupon to Specific Coupon.
  • Enter the Coupon Code manually.
Rule information coupon codes
  • 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.
Conditions the shopping cart coupon codes
  • Set the Conditions the shopping cart should meet for the Magento coupon code to be applied.
  • Click Save to 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.

Generate Multiple Coupon Codes
  • On the General Information page, mark the Use Auto Generation checkbox to publish a mass of coupon codes after saving the rule.
Manage coupon codes
  • Under Cart Price Rule, choose Manage Coupon Codes tab and do the following:
Coupons information
  • Set the Coupons Qty to 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 Format from 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 Character to 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 Generate button to release multiple coupon codes and they are shown on the table below.
Multiple coupon codes table

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.

Apply Coupon Codes Automatically

Now that you’ve got a coupon, there are 2 methods to generate a coupon auto-apply link.

Use quick coupon link generator

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

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:

Coupon link builder 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

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.

Table of content
    Jacker

    Jacker is the Chief Technology Officer (CTO) at Mageplaza, bringing over 10 years of experience in Magento, Shopify, and other eCommerce platforms. With deep technical expertise, he has led numerous successful projects, optimizing and scaling online stores for global brands. Beyond his work in eCommerce development, he is passionate about running and swimming.



    Related Post