2

enter image description hereI want to display some information in account dashboard. How to override default one with new one

I want a tab similar to the one highlighted in yellow box(with custom content like User Name, Dob, etc) to be displayed between the 'Account Information' block and 'Address Block'(where the red arrow is pointing).

2
  • Can share a screesnshot where you want to add ?
    – Amit Bera
    Sep 12, 2018 at 8:54
  • Shared the screenshot
    – Ravindra
    Sep 12, 2018 at 9:11

1 Answer 1

1

Manage from Custom module

If you want to changes the section from a custom module then

  1. create customer_account_index.xml at app/code/{Vendor}/{Module}/view/frontend/layout
  2. create a template mycustominfo.phtml at app/code/{Vendor}/{Module}/view/frontend/templates

Now, you add below code at customer_account_index.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>
        <referenceContainer name="content">
            <block class="Magento\Customer\Block\Account\Dashboard\Info" 
            name="customer_account_dashboard_mycustominfo" 
            as="mycustominfo"
            before ="customer_account_dashboard_info"   
        template="{Vendor}_{Module}::mycustominfo.phtml" cacheable="false"/>
        </referenceContainer>
    </body>
</page>

Manage from Theme module

If you want to changes the section from a custom theme then

  1. create customer_account_index.xml id not exits at app/design/{VendorTheme}/{ThemeName}/Magento_Customer/layout
  2. create a template mycustominfo.phtml at app/design/{VendorTheme}/{ThemeName}/Magento_Customer/templates

Now, you add below code at customer_account_index.xml

<?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">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Customer\Block\Account\Dashboard\Info" 
            name="customer_account_dashboard_mycustominfo" 
            as="mycustominfo"
            before ="customer_account_dashboard_info"   
        template="Magento_Customer::mycustominfo.phtml" cacheable="false"/>
        </referenceContainer>
    </body>
</page>

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.