Howdy Magento Folks?,

Welcome to our Magento 2 How to Blog Series. What are we going to do today? Today we are going to learn How To Remove Applied Cart Rules in Magento 2 programmatically. In case you haven’t caught our latest published article on How To Add JS File in Frontend for All Pages in Magento 2. Let’s start learning?.

Introduction:

Basically, when there is a scenario to create order programmatically in your Magento 2 store then there are many possibilities. Sometimes the imported order discount is not applied but as stated in Magento cart rules the discount must be applied. To overcome this situation admin need to just apply some cart rules for that specific cart order and after that, the discount will be applied successfully. Many times because of some difference between the total at checkout the problems are faced and to overcome this situation go through the easy solution given below.

If you are in need of creating order programmatically then look at this article How to Create Order Programmatically in Magento 2. Build your advanced checkout page now with the help of MageComp’s Magento 2 Checkout Success Page extension.

Steps to Remove Programmatically Applied Cart Rules in Magento 2:

Step 1: Firstly, you need to add di.xml in the following path.

app\code\Vendor\Extension\etc\di.xml

Step 2: Now, add RulesApplier.php file in following path:

app\code\Vendor\Extension\Plugin\SalesRule\Model\RulesApplier.php

That’s it you will be easily able to Remove Applied Cart Rules.

Final Words:

I would expect the solution given in the above solution was helpful for all and with that let’s conclude our blog. If you find any concerns regarding this article then do connect with our Support Team. But in the meantime, share the article with your Magento pals for helping them to get out of this problem. As always suggestions are always welcomed at MageComp write down in the comment section below. 

Happy Coding?

Click to rate this post!
[Total: 4 Average: 5]