Web Analytics

Fill the form & Get Installation Support

Magento 2 controller override

It is a quite simple tutorial with 2 steps:

Step 1:

Create di.xml file at app/code/[Name space]/[Your Module]/etc

In this example, we will rewrite controller Magento/Cms/Controller/Index/Index. In which, [Name Space]\[Your Module]\Controller\Cms\Index will be used to override Magento\Cms\Controller\index\Index –the homepage in original Magento 2.

Step 2: Define an overriding controller class

You need to create Index.php in app/code/[Name Space]/your Module]/Controller/Index

Done! I’m sure that you can follow this tutorial without any difficulty.

Fill the below form if you have any Magento programming need.





    Recent Articles

    Author Info

    Author Image

    Magento Certified Developer

    Hire J. Lakum

    Get a Free Quote





      /* second popup */

      Connect With Us