Remove Block from Layout in Magento 2


When you are creating your own Magento 2 extension, you often have to remove a block. This was very easy in Magento 1. In M2 it’s very easy as well, but it’s just done a bit differently. Below is what you could use in M1.

In Magento 2, this doesn’t work. The team at Magento has completely changed the way you remove a block from the layout in M2, and we’ll show you how to do it. The remove method is now simply

Practical Example:

As you can see, you place it between the body tags in the page layout in the layout.xml file that you are editing.┬áIt’s as simple as that! This method of removing a block this way has a few advantages over the old way, as you can now do things that previously were impossible. All in all its easier for Magento developers as you’ll be less frustrated when programming in the layout!


Leave A Reply