add/remove links on my account navigation magento 2
Add New layout handle

Method 1 - 

If creating new module: VendorName/ModuleName/view/frontend/layout/customer_account.xml

Method 2 - 

Apply using theme.

app/design/frontend/VendorName/themeName/Magento_Customer/layout/customer_account.xml.

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. 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-customer-balance-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-newsletter-subscriptions-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-product-reviews-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-account-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-account-edit-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-address-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-orders-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-gift-card-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-checkout-sku-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-giftregistry-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-reward-link" remove="true"/>
    </body>
</page>

Add Link

<referenceBlock name="customer_account_navigation">
    <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-custom-link" after="-" >
         <arguments>
             <argument name="label" xsi:type="string" translate="true">Custom Link Label</argument>
             <argument name="path" xsi:type="string">custom-path</argument>
         </arguments>
    </block>
</referenceBlock>


That's it... !!!

Experienced Magento Certified Developer with a demonstrated history of working in the information technology and services industry. Skilled in SQL, PHP, XAMPP, jQuery, and Microsoft Office. Strong engineering professional with a Master of Computer Applications

0 comments:

Post a Comment

Popular Posts

Have You Any Questins Let Us Know.

Contact Us
DENISH VACHHANI
Ahmedabad India