6

Customer name is not displayed after successful login in Magento 2. It only displays the default welcome message.

Can anyone help me?

1
  • you have to do its using your own method inside phtml file, This is comman issue in magento 2 many times after login not display customer name, You have to check if customer is login then get customer name from object and set using php way. Oct 14, 2016 at 12:08

2 Answers 2

3

try to override the theme header file in your theme:

app/design/frontend/
{YOUR VENDOR} / {YOUR THEME} / Magento_Theme / templates / html / header.phtml

  1. copy the content from the original file:

    / vendor / magento / module-theme / view / frontend / templates / html / header.phtml

  2. add this at the very top of the header.phtml file:

<script>
        require([
            'Magento_Customer/js/customer-data'
        ], function (customerData) {
            'use strict';
                customerData.reload(['customer']);
        })
</script>
1
-1

Customer name is not displayed after login in magento 2

This issue because of cache (I think your cache is disabled), enable cache it should work.

problem: When I turn off the cache system (all types of them), which cause heavy loading each time i refresh a page. In return, it affects the javascript / knockoutjs to work properly I think. The part for customer name in Magento_Customer/templates/account/customer.phtml is <span data-bind="text: customer().fullname"></span>

Your Answer

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

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