9

Now it looks like this:

  • Account Dashboard
  • Account Information
  • Address Book
  • My Downloadable Products
  • My Orders
  • Newsletter Subscription
  • Billing Agreements
  • My Product Reviews
  • My Wish List

I want to change the order to something like this:

  • Account Dashboard
  • My Orders
  • My Downloadable Products
  • My Wish List
  • My Product Reviews
  • Newsletter Subscription
  • Account Information
  • Address Book
  • Billing Agreements

I would prefer to edit the existing module and not to make new one

There is a similar question on stackexchange but it is for Magento 1
How to change magento My Account links order

Thanks!

6 Answers 6

4

We can rearrange these links by using "move". Reference to Magento document for more detail. Assume that you are working on customer_account.xml on your theme. In my case:

File path: app/design/frontend/Lhc/diamond/Magento_Customer/layout/customer_account.xml

Code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
    <body>
        <move element="customer-account-navigation-orders-link" destination="customer_account_navigation" before="customer-account-navigation-account-edit-link"/>
    </body>
</page>

The same with remain links you would like to sort. "customer-account-navigation-orders-link" is the block name in layout, using "before" and "after" element.

2
  • 2
    This does not work for me. I am able to move the block to a new destination (catalog.topnav for example. However, If I try to reorder with-in the customer_account_navigation block it does not work Nov 29, 2017 at 3:11
  • using <move> also has no effect for me :/ Also tried sortOrder..
    – 00-BBB
    May 7, 2019 at 13:09
4

I know this is an old post but you can change the order by changing the number here in the XML's

<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">
        <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-orders-link">
            <arguments>
                <argument name="path" xsi:type="string">sales/order/history</argument>
                <argument name="label" xsi:type="string" translate="true">Order History</argument>
                <argument name="sortOrder" xsi:type="number">220</argument>
            </arguments>
        </block>
    </referenceBlock>
</body>

So if you want sales order history to be next to My dashboard you'd need to change 220 to 240. Its 240 because the dashboard order number is 250.

1
4

For rearrange or change account link label override customer_account.xml into your theme or existing custom module.

in theme ...

app/design/frontend/{{vendor}}/{{theme}}/Magento_Customer/layout/customer_account.xml

or in existing custom module.

app/code/{{vendor}}/{{modulename}}/view/frontend/layout/

and update order of your link where you want to move.

<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
    <head>
        <title>My Account</title>
    </head>
    <body>
        <!-- 
            <referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/>       
            <referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
        -->
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-account-link">
                        <arguments>
                            <argument name="label" xsi:type="string" translate="true">Account Dashboard</argument>
                            <argument name="path" xsi:type="string">customer/account</argument>
                            <argument name="sortOrder" xsi:type="number">250</argument>
                        </arguments>
            </block> 
            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-orders-link">
                <arguments>
                    <argument name="path" xsi:type="string">sales/order/history</argument>
                    <argument name="label" xsi:type="string" translate="true">My Orders</argument>
                    <argument name="sortOrder" xsi:type="number">249</argument>
                </arguments>
            </block>
            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-downloadable-products-link">
                        <arguments>
                            <argument name="path" xsi:type="string">downloadable/customer/products</argument>
                            <argument name="label" xsi:type="string" translate="true">My Downloadable Products</argument>
                            <argument name="sortOrder" xsi:type="number">248</argument>
                        </arguments>
            </block> 
            <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">247</argument>
                </arguments>
            </block>

            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-product-reviews-link" ifconfig="catalog/review/active">
                <arguments>
                    <argument name="path" xsi:type="string">review/customer</argument>
                    <argument name="label" xsi:type="string" translate="true">My Product Reviews</argument>
                    <argument name="sortOrder" xsi:type="number">246</argument>
                </arguments>
            </block>

            <block class="Magento\Customer\Block\Account\SortLinkInterface" ifconfig="newsletter/general/active" name="customer-account-navigation-newsletter-subscriptions-link">
                <arguments>
                    <argument name="path" xsi:type="string">newsletter/manage</argument>
                    <argument name="label" xsi:type="string" translate="true">Newsletter Subscriptions</argument>
                    <argument name="sortOrder" xsi:type="number">245</argument>
                </arguments>
            </block>

            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-account-edit-link">
                        <arguments>
                            <argument name="label" xsi:type="string" translate="true">Account Information</argument>
                            <argument name="path" xsi:type="string">customer/account/edit</argument>
                            <argument name="sortOrder" xsi:type="number">244</argument>
                        </arguments>
            </block>   

            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-address-link">
                        <arguments>
                            <argument name="label" xsi:type="string" translate="true">Address Book</argument>
                            <argument name="path" xsi:type="string">customer/address</argument>
                            <argument name="sortOrder" xsi:type="number">243</argument>
                        </arguments>
            </block>


            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-billing-agreements-link">
                <arguments>
                    <argument name="path" xsi:type="string">paypal/billing_agreement</argument>
                    <argument name="label" xsi:type="string" translate="true">Billing Agreements</argument>
                    <argument name="sortOrder" xsi:type="number">242</argument>
                </arguments>
            </block>



            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-my-credit-cards-link">
                <arguments>
                    <argument name="path" xsi:type="string">vault/cards/listaction</argument>
                    <argument name="label" xsi:type="string" translate="true">My Payment Data</argument>
                    <argument name="sortOrder" xsi:type="number">241</argument>
                </arguments>
            </block>

        </referenceBlock>
    </body> </page>
2

Just add property after with block name in block to rearrange my account links. eg: here i have place after 'wishlist' after="customer-account-navigation-wish-list-link":

<block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-newsletter-subscriptions-link" after="customer-account-navigation-wish-list-link"></block>
1
  • You should specify which file to add this to, keeping in mind the requirement not to add a new module.
    – scrowler
    Jul 1, 2016 at 3:26
0

Just in case someone comes across this old question and wants to do this without coding... We published an extension for Magento 2 that allows to disable/remove, but also sort Customer Account Links by Configuration from Backend: For more details please see Customer Account Links Manager Extension

0

Anyone looking to reorder the customer account custom navigation link .This is the code that would go either

app/design/frontend/{{vendor}}/{{theme}}/Magento_Customer/layout/customer_account.xml

OR

app/code/{{vendor}}/{{modulename}}/view/frontend/layout/customer_account.xml

<referenceBlock name="customer_account_navigation">
        <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-custom">
            <arguments>
                <argument name="path" xsi:type="string">buyback/customer/index</argument>
                <argument name="label" xsi:type="string">Trade Orders</argument>
                 <argument name="sortOrder" xsi:type="number">230</argument>
            </arguments>
        </block>
    </referenceBlock>

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.