What Are Coupon Codes In Magento 2?
Holding a promotion campaign with attractive discounts is one of the best strategies for Magento e-commerce stores to boost sales quickly. In general, the store owners will create coupon codes for each campaign and ask the customers to submit the code when checkout in order to enjoy the discount.
There are 2 types of coupon codes: fixed coupon codes used for all purchasers and auto-generated coupon codes used for each buyer. For the first type, the store owners can promote it easily by sending it to customers’ emails, showing it on the promotional popup, catalogs, banners, advertisements, or printing it to give to the buyers directly. Meanwhile, the second type of coupon code is more personal, which will just be sent to buyers’ emails.
In Magento 2, coupon codes are generated and applied with Cart Price Rules – a set of conditions that the buyers’ shopping cart must fulfill in order to get the discount. For example, your promotion campaign is “$50 off on the cart for order more than $1000”, so the condition will be “Subtotal equals or greater than 1,000”, and when the cart meets this condition, the customers must submit the code “XXX-XXX” to get the discount. In the last tutorial, we have already shown you carefully How To Create Cart Price Rules in Magento 2, you can review it to understand more about cart price rules before learning to create coupon codes.
How To Create Coupon Codes In Magento 2?
As mentioned, there are 2 different types of promo codes, and we will show you how to create both of them step-by-step.
Case 1: Create Only 1 Coupon Code
In this case, all of the customers can use the same coupon code to get the discount.
In order to create a new coupon code for everyone, please follow the instructions in our previous tutorial – How To Create Cart Price Rule In Magento 2? (Creating coupon code is on the 2nd step).
Noting that you don’t check on the Use Auto Generation box. What you need to do is just add the Coupon Code (include either letters, numbers, or a combination of them), and define a number of uses per coupon/ customer (optional).
Case 2: Generate Different Coupon Codes
Differing from the first case, you don’t have to add the coupon code but check on the Use Auto Generation box. Then you can set the number of uses per coupon/ customer.

Next, you must move to the Manage Coupon Code section. Here you must add or select:
- Coupon Quantity: the exact number of coupon codes you want to issue.
- Code Length: the number of characters in the code. (E.g: Coupon Code is XSHFJGJ, so the code length is 7). It’s worth noting that the code prefix, code suffix, and separators are not included in the code length.
- Code Format: choose among Alphanumeric (both letters and numbers, e.g.: xhdk079), Alphabetical (letters only, e.g.: fsfsfsg), and Numeric (numbers only, e.g.: 4252525)
- Code Prefix: the first part in the coupon code (e.g: if you set the prefix as “Tigren-“, so the code will appear as “Tigren-535353”)
- Code Suffix: similar to the code prefix but the code suffix appears at the end of the coupon code (e.g: if you set the suffix as “-M2”, so the code will appear as “Tigren-53535353-M2”)
- Dash Every X Characters: in case you generate a long coupon code, adding the dash every X character would help the customers to read and copy the code easier. (e.g: Dash every 4 characters, so the code will appear as “Tigren-5353-5353-M2”


After that, you must click on the Generate button to create a batch of coupon codes as configuration. Then, it will display a list of coupon codes for you to preview. You can export this list to use for other purposes such as email marketing. Finally, save the Cart Price Rule.
How To Manage Coupon Codes In Magento 2?
First, you must go to the admin panel, then navigate to REPORTS and select Coupons under Sales (Admin Panel => REPORTS => Coupons)

Second, you need to select Store View (in the top-left corner) if you own multiple store views.

Third, in order to get the latest statistics, click on the message in the yellow box.
Fourth, start to filter date to get the report by setting Date Used (Order Created & Order Updated), Period (Day/ Month/ Year), date range (from… to…), Order Status.
Besides, if you don’t want no-data rows to appear in the report, set No in the Empty Rows. In the last field – Cart Price Rule, to generate a report of all coupon activities regardless of different price rules, you must select Any option. Conversely, to display only activities happening from a specific price rule, please choose the Specified option and one of the cart price rules in the list.

After completing the settings, click on the Show Report button in the upper-right corner. As a result, the report will be shown at the bottom of the page and you can easily export it to a CSV file.
We have shown you 2 ways to create the coupon codes as well as how to manage them in Magento 2. If you have any problems when following this tutorial, be free to ask us by leaving a comment below. See you in the next tutorial!
See More:
How To Create New Cart Price Rule In Magento 2?
How To Create New Catalog Price Rule In Magento 2?
[ratings]
How can I show data for rules which do not have a coupon code? This report is only showing me data for cart rules which have a coupon code associated with them. Thank you