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

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.

| improve this answer | |
  • @chanchal : please check above solution, if it worked, please accept answer. – Sangeeta Chandaliya Oct 3 '19 at 10:56
  • I tried the above solution,but it's not working. I have custom header template file. – chanchal Oct 3 '19 at 10:58
  • you need to add in xml layout file not in template file. – Sangeeta Chandaliya Oct 3 '19 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. – chanchal Oct 3 '19 at 11:01
  • add before="header.links" – Sangeeta Chandaliya Oct 3 '19 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.