Magento shopping cart price rules are the rules with conditions you set up in the Magento 2 admin panel during the sales, special offers, and any other promotional occasions to provide a discount.
So, creating the cart price rules in Magento 2 is a useful practice since it encourages customers to make more purchases in your store.
Follow the steps below to create Cart Price Rules in Magento 2:
1. Navigate to Marketing > Promotions > Cart Price Rules.
2. Once you press the Add New Rule button, you will have to complete 5 sections: Rule Information, Conditions, Actions, Labels, and Manage Coupon Codes.
3. Start with the Rule information and set the Rule Name.
4. Add the rule Description.
Note: this is the field where you leave some notes for yourself.
5. Enable the cart price rule by switching the Active to Yes.
6. Apply the rule for a specific Website.
7. Select the Customer Group you want the rule to be available for. It can be either General, Wholesale, Retailer or a group of Not Logged In customers.
However, if you need to, you can create a new customer group and it will appear in the list of customer groups.
Now be attentive. There is a slight difference between shopping cart price rule with and 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.
- Set the Date Magento 2 cart price rule will be available on.
- 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 one with the highest priority will be applied to that customer.
8. Enable Public In RSS Feed option to include the promotions in your store's public RSS feed.
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 the coupon can be used.
- Uses per Customer, in this case, determines the number of times the coupon can be used by the same user.
All the other options remain the same.
In this section, you set the conditions cart price rules will be enabled under. You define what the cart state should be for the discount to be applied. If any of the conditions here are not true the conditions in the Actions section won't be applied either.
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 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 quantity of products 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. And 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 configurations.
6. Choose whether to Discard subsequent rules. According to this option, the rules with the smaller priority figure won't be applied once this rule is used.
7. Set the Conditions the discount will be applied under. In this section, you define what items should 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.
Here set the Default Store View Label for the shopping cart price rule. It is needed when you manage a multi-language website and need to translate it for several languages.
This field is not available until you chose to Use Auto Generation of a Specific Coupon. (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. Only after you press Save, the rule proceeds with the coupon generation.
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. Then 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.
3. After you save the cart price rule, you can test it on the storefront.
This is an example of the cart price rule with a special coupon.
After we enter the discount code, we see that the order total is reduced in accordance with the discount amount set in the admin.
Learn how to find orders with discounts in Magento 2 admin.
So, you created the cart price rule to provide a discount for your customers on a special occasion.
“What is next?” you will ask.
The next step would be to display that offer to your customers. Usually, you show the discount or sale offer on your store with the CMS blocks.
Read this article on how to create CMS blocks in Magento 2 and learn about multiple places to display them on, and the extension that allows you to define the customer group, date and conditions to display them under.