Removing Welcome message from magento 2 - just xml
The welcome message is in html/header.phtml
and the block is referenced from this XML file: /vendor/magento/module-theme/view/frontend/layout/default.xml
. The template is referenced by the $_template
property within the \Magento\Theme\Block\Html\Header
block.
If you want to maintain some of the customer welcome functionality, you will need to override the template. However, if you want to remove that, you have two options. First, you can keep the header intact and just hide the welcome message with XML like this (ThemeNamespace/ThemeDirectory/view/frontend/layout/default.xml
):
<referenceBlock name="header">
<arguments>
<argument name="show_part" xsi:type="string">other</argument>
</arguments>
</referenceBlock>
If you want to completely remove the header.phtml
file altogether, the following XML in the same place should do that:
<referenceBlock name="header" remove="true"/>
In your theme 'your_theme/Magento_theme/layout/default.xml' add below code
<referenceBlock name="header.panel.wrapper" remove="true"/>