Magento – Add block in layout XML only for one store view

blockslayoutlayout-updatemagento-2.1xml

I have a Magento 2.1.x installation with two store views.
I would like to show a particular block in the footer only for one store view.

In Magento 1.9.x I would have done it in this way:

<STORE_storecode>
    <reference name="lorem_ipsum">
        <block type="..." />
    </reference>
</STORE_storecode>

How can I achieve that in Magento 2?

Best Answer

I'm not sure how you can do that in Magento 2, the cleanest way I can think of would be to :

  1. Create a new theme that uses your current theme as a parent
  2. Set your second store to use the new theme
  3. Extend the layout XML in your new theme with your change

You'll end up with the same effect, although it is more work than the method you mentioned for Magento 1.

Related Topic