How to configure shopping cart price rules in Magento 2?

Magento 2 provides you with the possibility to create shopping cart price rules and offer your customers a discount. Let’s consider how to set up a new rule. Say, you need a rule that will give 10% off with the coupon SECRET_DISCOUNT for everyone who has this coupon.

Step 1. Log in to your Admin panel and navigate to Marketing > Promotions > Cart Price Rule.

Step 2. Click on the Add New Rule button. On the opened page, you need to fill in 4 blocks: Rule Information, Conditions, Actions, and Label.

Step 3. In the Rule Information tab, set the Name, activate the rule, assign the rule to the Website, and choose the Customer Group who can use it. For our example, you need to choose the Specific Coupon in the dropdown. Limit the number of the Uses per Customer and Coupon rule. Set the Priority, if you have multiple Magento 2 cart price rules active at the same time.

shopping cart price rules in magento 2 the rule information tab example

Step 4. In the Condition tab, you can configure specific product attribute combinations, product subselection, conditions combination, or cart attributes that are needed for this rule. Or you can leave it blank. Magento shopping cart price rules for the configurable product will be applied for all products in this case.

Step 5. Next is the Actions tab. There you can choose one of the available actions that should be applied to the cart:

  • Percent of product price discount
  • Fixed amount discount
  • Fixed amount discount for the whole cart
  • Buy X get Y free

Here is how it looks in our example of Magento shopping cart rule:

shopping cart price rules in magento 2 the actions tab example

Set the Discount Amount and move to the last step.

Step 6. The last what you need to configure is the Labels tab. Enter the text for the Default Rule Label for All Store Views and Store View Specific Labels. You can create different labels for each store view.

Step 7. When you are ready, click on the Save button to apply the rule. Don’t forget to test the work of your shopping cart price rules on the Magento frontend.

 


 

Helpful hint: Configure any custom cart price rules with our Special Promotions Pro extension.

Here are just a few examples of the Magento discount rules you can apply right after the module installation:

  • Buy 2 X products and get the 2nd with a 30% discount
  • Buy a product and get $20 off another product
  • Buy the most expensive product with a 30% discount
  • Buy a product and get another one for free
  • Get a $50 discount for each $300 spent
  • Magento shopping cart price rules such as buy x get y free

How can I create custom conditions for a cart price rule in Magento 2?

To create custom conditions for a cart price rule in Magento 2, you can use the following steps:

  1. Create a custom module and define a new condition class that extends the Magento\Rule\Model\Condition\AbstractCondition class.
  2. Implement the validate method in the condition class to define the custom logic for the condition.
  3. In the backend, navigate to "Marketing" > "Cart Price Rules" and create a new cart price rule.
  4. In the "Conditions" tab, select "All" or "Any" and click on the "+" icon to add a new condition.
  5. Select "Custom" from the dropdown and enter the class path of the custom condition class you created.
  6. Save the cart price rule and test it to verify that the custom condition is working correctly.

By creating custom conditions for cart price rules in Magento 2, you can provide more flexibility and customization options for your promotions and discounts.

How can we help you?

Didn’t you find the answer to your question? We are always happy to help you out.

© 2009-2024 Amasty. All Rights Reserved.