Hello Magento Folks?,
Welcome To MageComp Blog. Today I will help you to Remove blocks or containers from layout Magento 2. Look at the most recently published blog about How to Upgrade Magento 2 with composer. So without further ado Let’s Dive In?.
Introduction
Mainly, Magento 2 provides many attractive options for attracting customers to your store. In appreciation to Magento we can say that it never fails in providing the updates as per the latest trends. It continuously tries to improve the customer experience. And in this continuous cycle, many times there is a requirement of removing a block from the layout in Magento 2. Look at the given below solution where it is illustrated with the help of codes.
Steps to Remove Blocks or Containers From Layout Magento 2
Step 1: Firstly, create layout file catalog_category_view.xml and add the following code in that layout file.
<referenceBlock name="block_name" remove="true"/>
Your Code will look like this.
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="content" remove="true" /> </body> </page>
Flush the cache and refresh the page you will be easily able to remove the container from the blog.
Final Words:
I hope after going through the above illustration you are able to remove containers from the layout of Magento 2. In case any difficulties do contact our Support Team form more guidance. If you like the solution then do share with your Magento buddies and don’t forget to comment down your reviews regarding the above article.
Happy Reading & Catch you on the next Magento Tutorial!