1

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

1 Answer 1

1

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.

15
  • @chanchal : please check above solution, if it worked, please accept answer. Commented Oct 3, 2019 at 10:56
  • I tried the above solution,but it's not working. I have custom header template file. Commented Oct 3, 2019 at 10:58
  • you need to add in xml layout file not in template file. Commented Oct 3, 2019 at 10:59
  • yes I have added in xml like below- <referenceContainer name="header.container"> <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" template="switch/stores.phtml"/> <block class="Magento\Framework\View\Element\Template" name="bd_custom_header" as="bd_custom_header" template="Magento_Theme::html/bd_custom-header.phtml" before="-"/> </referenceContainer> But still not working. Commented Oct 3, 2019 at 11:01
  • add before="header.links" Commented Oct 3, 2019 at 11:03

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.