Magento – Customer name is not displayed after login in Magento 2

customermagento2

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

Can anyone help me?

Best Answer

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>
Related Topic