0

How to add New "My Cart" links from the menu on customer account page?

0
0

Create customer_account.xml in your custom module

app/code/Vendor/Module/view/frontend/layout/customer_account.xml

<?xml version="1.0"?>
<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\Framework\View\Element\Html\Link\Current" name="mycart">
                <arguments>
                    <argument name="path" xsi:type="string">checkout/cart</argument>
                    <argument name="label" xsi:type="string">My Cart</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

If you don't have custom module you need to create customer_account.xml in your custom theme

app/design/frontend/Vendor/yourtheme/Magento_Customer/layout/customer_account.xml

enter image description here

0
0

Out these code in your module in these location

FIle Path: app/code/Extension/Module/view/frontend/layout/customer_account.xml

page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
    <body>
        <attribute name="class" value="account"/>
        <referenceContainer name="sidebar.main">
            <block class="Magento\Framework\View\Element\Html\Links" name="customer_account_navigation" before="-" template="Magento_Customer::account/navigation.phtml">
                <block class="Magento\Framework\View\Element\Html\Link\Current" name="customerdashboard_index_index">
                <arguments>
                    <argument name="path" xsi:type="string">customerdashboard/index/index</argument>
                    <argument name="label" xsi:type="string" translate="true">My Cart</argument>
                </arguments>
        </block>
            </block>
        </referenceContainer>
    </body>
</page>

And these code in these file

FIle Path: app/code/Extension/Module/view/frontend/layout/index.xml

<body>
    <referenceContainer name="content">
        <block class="Extension\Module\Block\Index\Index" name="index_help" template="Extension_Module::Index.phtml"/>
    </referenceContainer> 
 </body>

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.