How to Edit Header Content of a Custom Theme on Magento 2.3
-
07-02-2021 - |
Question
Please could someone help me out!
I want to edit the header content to either remove or hide the following sections:
-Compare -The Store Switcher (ELLYANA STORE) -The Language Selector (ELLYANA_EN ENGLISH)
I use a custom theme: Fastest Magento 2 Theme.
Thank you.
Solution
app/design/frontend/Codazon/fastest_grocery_gourmet/Magento_Theme/layout/default.xml
<body>
<referenceBlock name="store_language" remove="true"/> // To remove store language
<referenceBlock name="store_switcher" remove="true"/> // To remove store switcher
</body>
For the compare link, go to Stores>configuration> theme options> Product compare > Show compare page link in TopLinks area > No
OTHER TIPS
You can update your custom theme's header panel from below path.
Go to your Custom theme >> Magento_Theme >> Layout >> default.xml
from here you can move block or remove block from header, check below code for your reference.
/[magento-root-directory]/app/design/frontend/[your-custom-theme]/Magento_Theme/layout/default.xml
<body>
...
<move element="catalog.topnav" destination="header-wrapper" before="logo"/>
<move element="top.search" destination="header-wrapper" after="catalog.topnav" />
<move element="minicart" destination="header.links" />
<move element="store_language" destination="header.links" before="-" />
<move element="store.settings.currency" destination="header.links" after="store_language" />
<move element="header.links" destination="header-wrapper" after="logo"/>
......
<referenceBlock name="header.panel" remove="true"/>
<referenceBlock name="store_language" remove="true"/>
<referenceBlock name="header.links" remove="true"/>
...
</body>
Please try this and let me know if any issue.