Is it possible to call the default welcome message when user is logged in ("Welcome, customer.fullname") in a different .phtml?

I'd need this message in my Magento_Customer/templates/account/customer.phtml

  • do you know how to give override? Commented May 20, 2021 at 16:05
  • Overriding customer.phtml? Sure, but I still don't know how I would call the welcome message.
    – zlep
    Commented May 20, 2021 at 16:09
  • please check my answer Commented May 20, 2021 at 16:11
  • Also share the code of customer.phtml file, where you successfully showing the customer name. I shown you that the info.phtml file that shows the customer name sucessfully. Commented May 20, 2021 at 16:12
  • Also check your related block and layout file. Commented May 20, 2021 at 16:13

1 Answer 1


This code is from info.phtml file present at your_project_root/vendor/magento/module-customer/view/frontend/templates/account/dashboard/info.phtml

/** @var \Magento\Customer\Block\Account\Dashboard\Info $block */
<div class="block block-dashboard-info">
    <div class="block-title"><strong><?= $block->escapeHtml(__('Account Information')) ?></strong></div>
    <div class="block-content">
        <div class="box box-information">
            <strong class="box-title">
                <span><?= $block->escapeHtml(__('Contact Information')) ?></span>
            <div class="box-content">
                   Welcome, <?= $block->escapeHtml($block->getName()) ?><br>
                    <?= $block->escapeHtml($block->getCustomer()->getEmail()) ?><br>
                <?= $block->getChildHtml('customer.account.dashboard.info.extra'); ?>

I edited the above code as Welcome, (added) you can check above code, the above phtml file is linked with the block Info as commented in code, and this relation of block and phtml file is defined in the layout file.

Similarly, for your file customer.phtml you can check the function code in your block or copy the function from Info block or use the additional block of Info also and can solve it.

Please ask me if still you have doubts.

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.