Magento – magento 2.3 add store view switcher in custom header template

headerlanguage-switchermagento2.3.1store-view

I have two store views for two languages english and spanish in magento 2.3 EE.
The english store is default one and I want to add store view switcher drop down in my custom header template.

How to show that ?

The main requirement is that I want only one page in spanish with complete spanish header, footer and content. So, for that I have created the above two store views.
I am using custom weltpixel theme.
But store switcher is not showing up on header.

enter image description here

Best Answer

if you use magento default theme then in layout/default.xml add below code before </body> tag

<move element="header.switchers" destination="header.panel" before="header.links" />

UPDATED: full path should be like this - **app/design/frontend/Theme_Vendorname/Theme_name/Magento_Theme/layout/default.xml **

Put below code in default.xml

<block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="Magento_Store::switch/languages.phtml"/> 

run php bin/magento cache:clean command run php bin/magento cache:flush command

Now store switcher will show on the header part.

Related Topic