Create Coupon code in Magento 2

Today, Coupon Code is one of the important elements in marketing strategy as well as stimulating customer's shopping behavior.

With Magento, we are also supported to generate discount codes for our store including Catalog Price Rules and Cart Price Rules. Today I will guide you to create a discount code for your online store on Magento 2.

Catalog Price Rules: A type of discount that collects a number of conditions to apply such as customer group, product attributes, etc. This type of discount code is not published with a coupon code but will be discounted for the product. Placed and displayed directly in the catalog.

Cart Price Rules: A type of discount that is applied to the products in the cart based on certain conditions of the seller. If your shopping cart meets the set conditions, the discount code will be applied automatically or when the customer enters the discount code. This type of discount is applied seasonally or according to promotions through changing conditions for applying discount codes such as status, time, ...

1. Catalog Price Rules:

Step 1: According to the new rule:

On the Admin Panel, go to Marketing -> Promotions -> Catalog Price Rules -> Add New Rule.

Step 2: Fill in the basic information:

  • Enter Rule Name, Description, and Activate it.
  • Select the category to which the discount will be applied.
  • Select the customer group you want to apply this rule to. Because there are many different customer groups, you can choose different discount rates for each of them.

Date From and To: Specify the time when the rule applies.

Priority: Set the order of priority.

Step 3: Condition the rule:

Define conditions for a discount rule based on product attributes: category, SKU, material,... Leave blank if you want to apply to all products.

Step 4: Identify price rule actions in the portfolio. This section defines how the discount is applied:

Apply: Choose how to apply the discount.

Discount Amount: The discount amount will be calculated as a percentage or currency depending on the method you choose above.

2. Cart Price Rules:

Step 1: Create New Rule:

Login Admin Panel and go to MARKETING -> Cart Price Rules.

Step 2: Complete the basic information of the discount code:

Enter the discount code information in the Rule Information section.

Rule Name: Name of discount code.

Description: Description.

Active: Activate the code.

Websites: The page where you want to apply the discount code.

Customer Groups: Customer groups can use discount codes.

Coupon: Select Specific Coupon.

Coupon Code: Customize the discount code, you can choose Use Auto Generation to automatically generate the code.

Uses per Coupon: Number of codes.

Uses per Customer: Number of times each customer can use the code.

From/To: Time to apply the code.

Priority: Priority level, the lower the number, the higher the priority.

Public In RSS Feed: Enable or disable publishing in RSS Feed.

Step 3: Condition the rule: 

Product groups to which discount codes can be applied. Leave blank if you want to apply to all products.

Step 4: Edit properties:


Apply: Select the type of discount you want.

Percent of a product price discount: Product price discount by percentage

Fixed amount discount: Fixed amount discount.

Fixed amount discount for the whole cart: Fixed amount discount for the entire cart.

Buy X get Y free (discount amount is Y): Buy product X and get product Y free.

Discount Amount: Enter the percentage, the amount you want to reduce.

Maximum Qty Discount is Applied To: Enter the quantity of the product to be discounted.

Discount Qty Step (Buy X): Enter the amount of product X that the customer must buy to get product Y, only enter when you choose Buy X get Y free (discount amount is Y).

Apply to Shipping Amount: Select yes if you want to apply the discount to the shipping amount.

Discard subsequent rules: Select yes if you do not allow customers to apply another discount code after applying this code.

Free Shipping: Select yes if you want to add a free shipping offer.


Labels: Put a label for your ads.

Finally, select Save.

Above are the steps to generate the discount code on Magento. Hope it will be of help to you. Goodbye and see you again.