Removing 'Billing Agreements' from Magento 2 Customer Sidebar

Removing 'Billing Agreements' from Magento 2 Customer Sidebar
Learn how to remove the Billing Agreements link from the Magento 2 customer account sidebar. This guide walks you through modifying the customer_account.xml file in your theme or module to disable the link. Follow step-by-step instructions to locate the file, apply changes, and clear the cache for immediate results.
Table Of Content
Removing 'Billing Agreements' from Magento 2 Customer Sidebar
To remove the 'Billing Agreements' link from the customer account sidebar in Magento 2, you can modify the customer_account.xml
file in your theme or module. This link originates from the Magento_Paypal
module.
Steps to Remove the 'Billing Agreements' Link
Locate the customer_account.xml
File:
- Navigate to the Magento_Paypal module to find the original
customer_account.xml
file.
Add Code to Remove the Tab:
- Create a New XML File in Your Theme:
- Replace
{VendorName}
and{ThemeName}
with your specific vendor and theme names.
app/design/frontend/{VendorName}/{ThemeName}/Magento_Theme/layout/customer_account.xml
Add the Removal Code:
- In the newly created
customer_account.xml
file, insert the following code: - This code references the 'Billing Agreements' link block and removes it from the customer sidebar.
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<!-- Removing the 'Billing Agreements' Tab from the Customer Dashboard in Magento 2 -->
<referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
</body>
</page>
Clear the Cache:
- After saving the changes, clear Magento's cache to apply the modifications.
If you're not comfortable editing XML files, consider using the Customer Account Links Manager for Magento 2 extension. This tool allows you to manage and remove unwanted links from the customer dashboard without manual coding.
By following these steps, you can effectively remove the 'Billing Agreements' link from the customer account sidebar, enhancing the user experience on your Magento 2 store.
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.