cancel
Showing results for 
Search instead for 
Did you mean: 

after login not showing customer name in header

after login not showing customer name in header

after login not showing customer name in headerLogin.JPG

1 REPLY 1

Re: after login not showing customer name in header

Hi @sekhar_n,

 

Actually it is rendering from knockout js. It is default feature of magento 2. It shows arrow to go into my account and logout. 

For the workaround you can add any text in front of dropdown arrow. 
Copy the below file into your custom theme. 

vendor/magento/module-customer/view/frontend/templates/account/customer.phtml

add your text at the place of "Account" which I added before button. 

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile
/** @var Magento\Customer\Block\Account\Customer $block */
?>
<?php if($block->customerLoggedIn()): ?>
    <li class="customer-welcome">
        <span class="customer-name"
              role="link"
              tabindex="0"
              data-mage-init='{"dropdown":{}}'
              data-toggle="dropdown"
              data-trigger-keypress-button="true"
              data-bind="scope: 'customer'">
            Account
            <button type="button"
                    class="action switch"
                    tabindex="-1"
                    data-action="customer-menu-toggle">
                <span><?= $block->escapeHtml(__('Change')) ?></span>
            </button>
        </span>
        <script type="text/x-magento-init">
        {
            "*": {
                "Magento_Ui/js/core/app": {
                    "components": {
                        "customer": {
                            "component": "Magento_Customer/js/view/customer"
                        }
                    }
                }
            }
        }
        </script>
        <?php if($block->getChildHtml()):?>
        <div class="customer-menu" data-target="dropdown">
            <?= $block->getChildHtml() ?>
        </div>
        <?php endif; ?>
    </li>
<?php endif; ?>


I hope it will help you!