Menu Close
    Searching for an experienced Magento 2 Development Company ?

    Override/Extend routes in existing modules Magento 2

    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.

    . . .
    Discuss on Helpdesk

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top