Hello Magento Friends,

Today’s Magento tutorial for the “How To” category defines How to Override Core Plugin Method in Magento 2. 

While customizing orders, Magento uses a plugin to verify the order was placed or not. Modifying the core file is not an appropriate option. In this situation, you can override core plugin methods.

Let’s dive in for the steps to Override Core Plugin Method in Magento 2.

Steps to Override Core Plugin Method in Magento 2:

Step 1: Create a file in the below path

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

Now, add the below code

Step 2: Now go to the below path

app\code\Vendor\Extension\Plugin\StockState\CheckQuoteItemQtyPlugin.php

And add the code as follows

Conclusion:

This way you can Override Core Plugin in Magento 2. Check out the related blog – How to Override core code using Custom Plugin in Magento 2.

If you have any difficulty, connect with me via the comment box. Share the article with your friends and see you in the next article.

Happy Coding!

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