0

enter image description here

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 :)

3

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"/>
  • 1
    I want to check that if value is true then remove this link when this dashboard page load.. If value is false then this link not removed. How is it possible? – Rohan Hapani May 24 '17 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.