Quantcast
Channel: Webkul Blog
Viewing all articles
Browse latest Browse all 5490

Override/Extend routes in existing modules Magento 2

$
0
0

We will learn how to override/extend routes in the existing module.
We can add the before or after parameters in the module node of the routes.xml file.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="catalog">
            <module name="Webkul_CustomCatalog" before="Magento_Catalog" />
        </route>
    </router>
</config>

According to these configurations, FrontController looks for the actions in the Webkul_CustomCatalog before searching in the Magento_Catalog module.
In the same way, after parameters will work.

So with this configuration of routes.xml, we can use the catalog route for the Webkul_CustomCatalog module as well.

Hope it will help you. Thank You.


Viewing all articles
Browse latest Browse all 5490

Trending Articles