You want to add some additional functionality to the customer section and you want it to reside under the customer frontname created by the magento-customer module.

How do you do this?

In app/code/[codePool]/[Vendor]/[ModuleName]/etc/frontend/routes.xml:

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="customer">
            <module name="[Vendor]_[ModuleName]" after="Magento_Customer" />

There are two important bits.

Firstly, because you are attaching to an existing route, you do not need to specify a frontName attribute.

Secondly, and most importantly you are telling Magento to look at your module after the Magento_Customer one to see if a class can be found for the request.

For another example see the Magento_UrlRewrite module.

  • magento2

Like this post? Share it :)

Related Posts