Hello,
On the top header there is the welcome part with the name and then again the name, any idea how to fix this (only to get the welcome part)?
Solved! Go to Solution.
Open vendor/magento/module-theme/view/frontend/templates/html/header.phtml .This template is responsible for displaying welcome message. So overwrite this phtml and replace by following content.
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // @codingStandardsIgnoreFile /** * @var \Magento\Theme\Block\Html\Header $block */ $welcomeMessage = $block->getWelcome(); ?> <?php switch ($block->getShowPart()): case 'welcome': ?> <li class="greet welcome" data-bind="scope: 'customer'"> <!-- ko if: customer().fullname --> <span data-bind="html: '<?= $block->escapeHtml(__('Welcome')) ?>'"></span> <!-- /ko --> <!-- ko ifnot: customer().fullname --> <span data-bind='html:"<?= $block->escapeHtml($welcomeMessage) ?>"'></span> <?= $block->getBlockHtml('header.additional') ?> <!-- /ko --> </li> <script type="text/x-magento-init"> { "*": { "Magento_Ui/js/core/app": { "components": { "customer": { "component": "Magento_Customer/js/view/customer" } } } } } </script> <?php break; ?> <?php case 'other': ?> <?= $block->getChildHtml() ?> <?php break; ?> <?php endswitch; ?>
Now Clear cache.
Open vendor/magento/module-theme/view/frontend/templates/html/header.phtml .This template is responsible for displaying welcome message. So overwrite this phtml and replace by following content.
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // @codingStandardsIgnoreFile /** * @var \Magento\Theme\Block\Html\Header $block */ $welcomeMessage = $block->getWelcome(); ?> <?php switch ($block->getShowPart()): case 'welcome': ?> <li class="greet welcome" data-bind="scope: 'customer'"> <!-- ko if: customer().fullname --> <span data-bind="html: '<?= $block->escapeHtml(__('Welcome')) ?>'"></span> <!-- /ko --> <!-- ko ifnot: customer().fullname --> <span data-bind='html:"<?= $block->escapeHtml($welcomeMessage) ?>"'></span> <?= $block->getBlockHtml('header.additional') ?> <!-- /ko --> </li> <script type="text/x-magento-init"> { "*": { "Magento_Ui/js/core/app": { "components": { "customer": { "component": "Magento_Customer/js/view/customer" } } } } } </script> <?php break; ?> <?php case 'other': ?> <?= $block->getChildHtml() ?> <?php break; ?> <?php endswitch; ?>
Now Clear cache.
Thanks!