How to Remove the "My Downloadable Products" Link from the Customer Account Menu in Magento 2
When managing a Magento 2 store, you may need to customize the customer account menu by removing certain links that are not relevant to your business. One such link is the "My Downloadable Products" link. Below is a step-by-step guide on how to remove this link from the customer account menu.
Step 1: Create a Custom Module
To make this change, it's best to create a custom module. This keeps your changes modular and avoids directly modifying core files.
- Create the module directory structure:
app/code/Vendor/RemoveDownloadableLink
- Create the
registration.php
file: - Create the
module.xml
file:
Step 2: Use a Layout XML File to Remove the Link
Magento allows you to remove blocks or containers using layout XML files. In this step, you will create a layout file to remove the "My Downloadable Products" link.
- Create the
customer_account.xml
layout file:app/code/Vendor/RemoveDownloadableLink/view/frontend/layout/customer_account.xml
- Add the following code to
customer_account.xml
:This code targets the specific block that generates the "My Downloadable Products" link and removes it.
Step 3: Clear Cache and Test
After setting up the module, clear the Magento cache and check if the link has been successfully removed.
- Enable the module:
Run the following command to enable your custom module:
bin/magento module:enable Vendor_RemoveDownloadableLink
- Clear the cache:
bin/magento cache:clean
- Test the removal:
Log in to a customer account in the frontend, and you should no longer see the "My Downloadable Products" link in the account menu.
Conclusion
By following these steps, you can easily remove the "My Downloadable Products" link from the customer account menu in Magento 2. This method ensures that your changes are clean, and maintainable, and don't affect other parts of your Magento installation.
For more detailed Magento 2 tutorials and expert advice, feel free to contact us at [email protected], or visit ArmMage.
Comments