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.
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:
Here is how it looks in our example of Magento shopping cart rule:
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:
To create custom conditions for a cart price rule in Magento 2, you can use the following steps:
Magento\Rule\Model\Condition\AbstractCondition
class.validate
method in the condition class to define the custom logic for the condition.By creating custom conditions for cart price rules in Magento 2, you can provide more flexibility and customization options for your promotions and discounts.
Login and Registration Form