After logging in, the user name is not displaying between 'Wilkommen' and 'Anmelden' .
Which files are responsible for rendering out this part of the header ?
How to get the user name of the currently logged in user ?
After logging in, the user name is not displaying between 'Wilkommen' and 'Anmelden' .
Which files are responsible for rendering out this part of the header ?
How to get the user name of the currently logged in user ?
Which files are responsible for rendreing out this part of the header ?
/vendor/magento/module-theme/view/frontend/templates/html/header.phtml
<span data-bind="text: customer().fullname ? $t('Welcome, %1!').replace('%1', customer().fullname) : '<?=$block->escapeHtml($welcomeMessage) ?>'"></span>
If you have third party theme, the file path can be app/design/frontend/Vendorname/theme762/Magento_Theme/templates/html/header.phtml
How to get the username of the currently logged in user ?
Refer the answer
For customer name you need to check
vendor/magento/module-theme/view/frontend/templates/html/header.phtml
code : <span data-bind="text: new String('<?php echo $block->escapeHtml(__('Welcome, %1!', '%1'));?>').replace('%1', customer().firstname)">
</span>
Data is being fetched by knockout js using :
<script type="text/x-magento-init">
{
"*": {
"Magento_Ui/js/core/app": {
"components": {
"customer": {
"component": "Magento_Customer/js/view/customer"
}
}
}
}
}
</script>