Understanding that each business has its own story, to give a personalized touch to store always ends up with customization & development. Over the time Magento has topped Ecommerce CMS list with its functionality, features and power of extending the native functionalities. Compared to Magento 1, In Magento 2 overriding and manipulating with classes is becoming easier a developer to play quickly. At MageComp, we have never recommended modifying default core functionalities, but we can extend core functionalities using concepts of overriding which is a safe and easy way to achieve customization or development.

The extension plays an important role to achieve customization in Magento 2 but when there are tons of extensions installed within a store environment it creates conflicts with other extensions. At that time to quickly get rid of the problem, the easiest solution comes to mind is to override custom extension controller file. By default, there are three different ways to override core functionalities. Today we will use preference method to override any custom module controller into your extension.

Firstly, we need to notify Magento for overriding functionality by creating ‘di.xml’ at below path.
app\code\Vendor\Extension\etc\di.xml

Now, you need to create your extension controller file at the following path by adding your own logic to below code.
app\code\Vendor\Extension\Controller\Adminhtml\Customcontroller\Customaction.php
Click to rate this post!
[Total: 12 Average: 3.7]