How to Create Magento 2 Cart Price Rules?

When the sales season rolls around you need to make sure to lure more customers to your store. One way to do this is Magento 2 cart price rules. These are the rules you set up in the admin panel during sales, special offers, and any other occasions to provide a discount.

Thus, creating the Magento cart price rules not only encourages customers to purchase more. They allow you to manage discounts in Magento more effectively. 

So, today you'll learn how to create Magento shopping cart rules and discover how they can benefit your business.

Step 1: Add New Cart Price Rule

1. Navigate to Marketing > Promotions > Cart Price Rules and press the Add New Rule button. You will have to complete 5 sections: Rule Information, Conditions, Actions, Labels, and Manage Coupon Codes.

Magento 2 Cart Price Rule

2. Start with the Rule information and set the Rule Name.

3. Add the rule Description. It is the field where you leave some notes for yourself.

4. Enable the cart price rule by switching the Active to Yes.

5. Apply the rule for a specific Website.

6. Select the Customer Group you want the Magento 2 cart price rule to be available for. It can be either General, Wholesale, Retailer or a group of Not Logged In customers. 

magento 2 cart price rules

Now be attentive. There is a slight difference between shopping cart price rule with and without a coupon.

7. Choose whether you want to create a coupon code.

Magento Cart Price Rule Without a Coupon

If you choose to create a cart price rule without a coupon you have to set Uses per Customer option. It defines the number of times the rule can be used by the same customer.

magento cart price rules without a coupon

Magento Cart Price Rule With a Coupon

Once you choose to create a Specific Coupon some additional fields will appear.

  • Set the Coupon Code for this specific cart price rule. You can choose the Automatic Generation so you will be able to generate multiple coupon codes after you select and save the rule.
  • The next option is Uses per Coupon. It defines the number of times a coupon can be used.
  • Uses per Customer, in this case, determines the number of times a coupon can be used by the same user.

magento cart pricerule with coupon


Magento 2 Coupon Code Extension is a tool that allows you to generate coupon code links based on cart price rules and apply them automatically. It enables you to redirect customers to any of your store pages and...

one-time payment
Buy Now Live Demo

8. Set the Date Magento 2 cart price rule will be available on.

9. Set the Magento 2 cart price rule Priority that defines its relation to other rules.

e.g. when there are two cart price rules created and a customer falls under both rule conditions, only the rule with the highest priority will be applied to a customer.

10. Enable Public In RSS Feed option to include the promotions in your store's public RSS feed.

magento cart price rule date limit

Step 2: Set Cart Price Rules Conditions

In this section, you set the conditions cart price rules will be enabled under. You define what the cart state should be for a discount to be applied.

Note: If any of the conditions here are not true the conditions in the Actions section won't be applied either.

cart price rules conditions magento

Step 3: Set Cart Price Rule Actions

1. Choose what kind of discount to Apply according to the Magento cart price rule. It can be either Percent of product discount, Fixed Amount Discount, Fixed amount Discount for the whole cart, or Buy X get Y (discount amount is Y).

2. Set the actual Amount of the Discount.

3. Setting the Maximum Qty Discount is Applied To you define the number of product purchases a customer has to make in order to get a discount for the very same purchase.

4. Set the number of products a customer has to purchase to receive a discount in Discount Qty Step (Buy X) field. This option is set in case you choose to apply Buy X get Y Free Discount.

5. Enable the Apply to Shipping Amount to choose a discount to be applied for the shipping amount as well.

Note: the way the shipping discount is applied depends on the kind of discount you choose.

e.g. if you choose the Percent of Product Price, the shipping discount is applied to the shipping and subtotal separately. If you choose the Fixed amount discount, it is applied to the subtotal.

Different shipping methods have different price and handling fee options. So, before applying the cart price rule to the shipping amount check out the shipping method settings.

6. Choose whether to Discard subsequent rules. According to this option, the rules with the smaller priority value won't be applied once this rule is used.

magento 2 shopping cart rules actions

7. Set the Conditions the discount will be applied under. In this section, you define what items should it be applied to.

Note: usually this field is left blank, since if left blank the discount is applied to all cart items.

8. Choose the option that determines the discount applying to the Free Shipping. You can choose to apply the discount For matching items only, For shipment with matching items, or to not apply the discount for the free shipping.

shoppingcart rules conditions

Step 4: Set the Cart Price Rule Labels

Here set the Default Store View Label for the shopping cart price rule. It is needed if you manage a multi-language website and need to translate it for several languages.

cart price rule label

Step 5: Manage Coupon Codes

This field is not available until you chose to Use Auto Generation of a Specific Coupon in the rule information section.

Attention: when you choose to generate the coupon codes automatically it is better to save the cart price rule once you put the checkmark in the Use Auto Generation select box. It is only after you press save, that the cron proceeds with the coupon generation.

manage coupon codes in magento

1. To start coupon Auto Generation fill out the following fields:

  • Coupon Qty which defines how many coupons you want to generate.
  • Length of the coupon code (in characters).
  • Code Format which can be Alphanumeric, Alphabetical and Numeric.
  • Code Suffix and Prefix of the coupon (the number of their figures will be included in the general length of the code).
  • Dash Every X Characters to add dashes to your coupon code.

Note: the same as with the Prefix and Suffix, dashes are included in the code length.

2. Press the Generate button. In case you are using the Magento version up to 2.3, the coupon codes will be generated instantly, but if it is 2.3 and higher you will need to wait for an extra 2-3- seconds for the cron job to generate the codes.

Once you Save the Magento cart price rule, you can test it on the storefront.  After we enter the discount code, we see that the order total is reduced in accordance with the discount amount set in the admin. This is an example of the cart price rule with a special coupon:

Magento 2 cart price rules discount

Apply Coupon Codes Automatically in Magento

So, you've created Magento 2 cart price rules to provide a discount for your customers on any special occasion. You can send it to your customers via email, share special discounts on social media or display coupons anywhere in your store. 

However, imagine customers who have to copy a coupon and paste it on checkout manually. So to take your customers' experience to the next level, you can try to apply coupon codes automatically.