I've literally put this in my theme's default.xml file:

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

And the store switcher is not showing up. Am I doing something wrong?

  • Have you created store view in backend ? – hweb87 May 10 '18 at 5:33

Please mention the reference container where do you want to add the store switcher. See the below code for reference:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceContainer name="footer">
            <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" after="footer_links" template="Magento_Store::switch/stores.phtml"/>

You need to mention 2 things one is reference container where you want to show the block and second one is the after="footer_links"(Not necessary but needed if you want to order the switcher position through xml).

Hope this helps.

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.