I want to remove these links Downloadable products, My wishlist, Stored payment method, Billing agreement
form customer My Account page. Do you have any idea?
4 Answers
Add in layout file: app/design/frontend/VendorName/themeName/Magento_Customer/layout/customer_account.xml
<!-- Store credit -->
<referenceBlock name="customer-account-navigation-customer-balance-link" remove="true"/>
<!-- Downloadable product link -->
<referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/>
<!-- Subscription link -->
<referenceBlock name="customer-account-navigation-newsletter-subscriptions-link" remove="true"/>
<!-- Billing agreement link -->
<referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
<!-- Product review link -->
<referenceBlock name="customer-account-navigation-product-reviews-link" remove="true"/>
<!-- My credit card link -->
<referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/>
<!-- Account link -->
<referenceBlock name="customer-account-navigation-account-link" remove="true"/>
<!-- Account edit link -->
<referenceBlock name="customer-account-navigation-account-edit-link" remove="true"/>
<!-- Address link -->
<referenceBlock name="customer-account-navigation-address-link" remove="true"/>
<!-- Orders link -->
<referenceBlock name="customer-account-navigation-orders-link" remove="true"/>
<!-- Wish list link -->
<referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>
<!-- Gift card link -->
<referenceBlock name="customer-account-navigation-gift-card-link" remove="true"/>
<!-- Order by SKU -->
<referenceBlock name="customer-account-navigation-checkout-sku-link" remove="true"/>
<!-- Gift registry -->
<referenceBlock name="customer-account-navigation-giftregistry-link" remove="true"/>
<!-- Reward points -->
<referenceBlock name="customer-account-navigation-reward-link" remove="true"/>
-
1Hey, how did you get this information, is it in vendor somewhere? Otherwise I will be bookmarking the hell out of this answer XD Dec 10, 2020 at 9:45
Create a new module: i.e. VendorName_ModuleName
(If you don't have already)
Add a layout file:
VendorName/ModuleName/view/frontend/layout/customer_account.xml
Remove links like below:
<?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>
<referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>
<referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
</body>
</page>
Add new layout handle to one of places:
If creating new module: VendorName/ModuleName/view/frontend/layout/customer_account.xml
If creating new theme, 2 similar layout handles should be created to declare removal of each block separately: app/design/frontend/VendorName/themeName/Magento_Wishlist/layout/customer_account.xml (and similar layout for billing agreement module etc)
Layout handle content:
<?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>
<referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>
<referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
</body>
</page>
I found solution for the above question. Added answer here for helping people.
I copied customer_account.xml
file from vendor
directory vendor\magento\module-wishlist\view\frontend\layout\customer_account.xml
to my custom theme directory app\design\frontend\VendorName\themeName\Magento_Wishlist\layout\customer_account.xml
.
Here is the code of my theme customer_account.xml
file.
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>
<referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
<referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/>
<referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/>
</body>
</page>