Removing the Newsletter Tab from the Customer Dashboard in Magento 2

Removing the Newsletter Tab from the Customer Dashboard in Magento 2
If you want to streamline the customer experience and remove the "Billing Agreements" link from the customer sidebar in Magento 2, it's a simple process that involves modifying your theme's layout XML.
Table Of Content
Removing the Newsletter Tab from the Customer Dashboard in Magento 2
To remove the "Newsletter" tab from the customer dashboard in Magento 2, follow these steps:
Create a Layout XML File:
- Navigate to your theme's layout directory:
- Create a file named
customer_account.xml
if it doesn't exist.
app/design/frontend/{VendorName}/{ThemeName}/Magento_Customer/layout/
Add XML Code to Remove the Newsletter Tab:
- Insert the following code into
customer_account.xml
: - This code targets the block responsible for the "Newsletter" link and removes it.
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<body>
<referenceBlock name="customer-account-navigation-newsletter-subscriptions-link" remove="true"/>
</body>
</page>
Clear Cache and Refresh:
- After saving the changes, clear the Magento cache to apply them.
Additional Information
If you need to remove other tabs or links from the customer dashboard, you can use similar methods by targeting the respective block names. For example, to remove the "My Wish List" link, you would use:
<referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>
For a more user-friendly approach, consider using extensions like the Customer Dashboard Links Manager for Magento 2. This tool allows you to manage dashboard links without coding.
Tip
To enhance your eCommerce store’s performance with Magento, focus on optimizing site speed by utilizing Emmo themes and extensions. These tools are designed for efficiency, ensuring your website loads quickly and provides a smooth user experience. Start leveraging Emmo's powerful solutions today to boost customer satisfaction and drive sales!
FAQs
How Can I Remove the 'Billing Agreements' Tab in Magento 2?
You can remove the 'Billing Agreements' tab from the customer dashboard sidebar by modifying the customer_account.xml
file and using the <referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
node.
Where Is the customer_account.xml File Located?
The customer_account.xml
file is typically found at the following path:
app/design/frontend/{VendorName}/{ThemeName}/Magento_Customer/view/frontend/layout/customer_account.xml
What Is an Example of Removing the 'Billing Agreements' Tab?
To remove the 'Billing Agreements' tab, add the following code inside customer_account.xml
:
<referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
What Happens After I Remove the 'Billing Agreements' Tab?
Once you remove the tab using the XML file, it will no longer appear in the customer dashboard sidebar. However, the billing agreements section itself will still exist; it just won't be accessible from the sidebar.
Do I Need to Clear the Cache After Removing the Tab?
Yes, after modifying the customer_account.xml
file, you should clear the Magento cache to apply the changes:
php bin/magento cache:clean
Can I Remove Other Customer Navigation Links?
Yes, you can remove any customer navigation links by using a similar approach. For example, to remove the 'My Orders' or 'My Wishlist' links, just reference their block names and set remove="true"
in your customer_account.xml
file.