I want to remove customer account navigation tab without use of xml file.
How to remove this ABC customer account navigation link in magento2?
Please help me...
Thanks in advance :)
I want to remove customer account navigation tab without use of xml file.
How to remove this ABC customer account navigation link in magento2?
Please help me...
Thanks in advance :)
In Magento 2 these links are controlled by the class Magento\Customer\Block\Account\Navigation
. This block is added to the sidebar in the xml Magento/Customer/view/frontend/layout/customer_account.xml
.
To add a new link you need to reference this block and then can add a child block as follows.
<referenceBlock name="customer_account_navigation">
<block class="Magento\Customer\Block\Account\SortLinkInterface" ifconfig="wishlist/general/active" name="customer-account-navigation-wish-list-link">
<arguments>
<argument name="path" xsi:type="string">wishlist</argument>
<argument name="label" xsi:type="string" translate="true">My Wish List</argument>
<argument name="sortOrder" xsi:type="number">210</argument>
</arguments>
</block>
</referenceBlock>
If the link you are trying to remove is built like the wishlist you can turn it on or off via the system configuration (see ifconfig="wishlist/general/active"
).
If the link you are trying to remove is not built with such a flag then you will have to remove the block via it's name as follows:
<referenceBlock name="block_name" remove="true"/>