11

I'm trying to remove some tabs and change the navigations title : enter image description here

As you can see above navigation How to remove some navigation and change the title ? For example removing Address Book change NewsLetter Subscriptons to Subscription

I was looking for the css file nav items and found this :

<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
/** @var $block \Magento\Framework\View\Element\Html\Links */
?>
<?php /** @var $block \Magento\Customer\Block\Account\Navigation */ ?>
<div class="block account-nav">
    <div class="title">
        <strong><?php /* @escapeNotVerified */ echo __('My Account'); ?></strong>
    </div>
    <div class="content">
        <nav class="account-nav">
            <ul class="nav items">
                <?php echo $block->getChildHtml();?>
            </ul>
        </nav>
    </div>
</div>

From here I was looking for the \Magento\Framework\View\Element\Html\Links but kinda stuck and have no idea what to do.

I'm new to magento 2 so kinda noob here.

3 Answers 3

43

1 ) Add below code in your extended default.xml file to remove Account tabs links.

app/design/frontend/vendorname/themename/Magento_Theme/layout/default.xml

Here is list of code to remove account tabs as needed. Will helpful to you and other users as well

        <!-- Address link -->
        <referenceBlock name="customer-account-navigation-address-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"/>


        <!-- Orders link -->
        <referenceBlock name="customer-account-navigation-orders-link" remove="true"/>

        <!-- Wish list link -->
        <referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>

2 ) Renaming Newsletter Subscriptions

Copy customer_account.xml from

vendor/magento/module-newsletter/view/frontend/layout/customer_account.xml

To your extended module

app/design/frontend/vendorname/themename/Magento_Newsletter/layout/customer_account.xml

Let me know if any problem.

Keep cache disable while changing any XML file

6
  • thanks for your help, but how do you get all thos name ? like customer-account-navigation-wish-list-link Jul 24, 2017 at 6:49
  • 2
    vendor/magento/module-customer/view/frontend/layout/customer_account.xml here you can find these links , other link can be found in there simultaneous modules...like wish list in vendor/magento/module-wishlist/view/frontend/layout/customer_account.xml Jul 24, 2017 at 6:53
  • I am using Magento 2.2 and I have to say that is not true, that file has none of the names you listed above. May 8, 2018 at 19:55
  • @DustinPoissant if not present then you need to create those files,,copy from vendor to you custom theme May 9, 2018 at 9:32
  • @ManojDeswal, How to remove dashboard page and set order history page as default? Sep 5, 2019 at 6:28
2

Create xml file in your custom theme app/design/frontend/Custom/mytheme/Magento_Customer/layout/customer_account.xml

<?xml version="1.0" encoding="UTF-8"?>
<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-address-link" remove="true"/>
    </body>
</page> 


For Changing newsletter subscriptions to subscriptions, copy file vendor/magento/module-newsletter/view/frontend/layout/customer_account.xml in your custom theme app/design/frontend/Custom/mytheme/Magento_Newsletter/layout/customer_account.xml and change the required text.
Then run commands for static content deploy and cache flush.

0
0

Remove the Invitation Link from Dashboard Sections.

<!-- Invitations -->
<referenceBlock name="customer-account-navigation-magento-invitation-link-container" remove="true"/>

Remove Additional Sidebar from My account (Dashboard)

<!-- Additional Sidebar -->
<referenceContainer name="sidebar.additional" remove="true" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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