0

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?

1
  • Have you created store view in backend ? May 10, 2018 at 5:33

1 Answer 1

1

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">
    <body>
        <referenceContainer name="footer">
            <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" after="footer_links" template="Magento_Store::switch/stores.phtml"/>
        </referenceContainer>
    </body>
</page>

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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