Back to Top

Remove Blocks or Containers from Magento 2 Layout

Updated 16 February 2024

Today i am explaining how to remove blocks or containers called by layout files.

Firstly you need to create layout file for the same controller.
for example : catalog_category_view.xml

Now add the line in your layout file:

<referenceBlock name="your block name" remove="true" />

in this, you can use referenceBlock for the blocks, and referenceContainer for the containers.
name, is the name of the block or container which you want to remove.
remove, is set to true to remove.

your file will be like this:

Searching for an experienced
Magento 2 Company ?
Find out More
<?xml version="1.0"?>
<page xmlns:xsi="" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
		<referenceBlock name="content" remove="true" />

After flushing cache, the whole content container will get removed from category page.

Hope, this will helps you adding functionality in your module.

I hope this blog will help you with Remove Blocks or Containers from Layout Magento 2. You may also check our wide range of best Magento 2 Extensions.

Please reach out to our team via a support ticket if you have any queries.

Try this and if you have any queries then just comment below 🙂

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home