{"id":553,"date":"2019-08-14T23:53:10","date_gmt":"2019-08-14T23:53:10","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/08\/14\/remove-block-from-layout-in-magento-2\/"},"modified":"2025-05-22T16:09:48","modified_gmt":"2025-05-22T10:39:48","slug":"remove-block-from-layout-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/remove-block-from-layout-in-magento-2\/","title":{"rendered":"How to Remove Block From Layout in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Magento 2 store designs must constantly be updated based on the business requirements, latest trends, and for the improvement of customer experience.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As a part of this process, you may require to add or remove a block from the layout in Magento 2. Here, I\u2019ve shown how to remove block from layout in Magento 2 with a programmatic solution.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One can use this method in various ways. For example, the store is running a Christmas offer and had added a promotional offer block on the home page which needs to be removed post offer. Also, you may want to remove any default blocks for which the method is useful.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019ve taken an example of removing the coupon code application block on the checkout page. If you want to remove a promo code that you are currently offering, you can do so by removing that block from the checkout.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Remove Block From Layout in Magento 2:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">All you have to do is:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;referenceBlock name=\"block_name\" remove=\"true\"\/><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example, remove the coupon code block from the checkout cart page:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In&nbsp;<strong>checkout_cart_index.xml<\/strong>,<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" layout=\"1column\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\">\n    &lt;body>\n        &lt;referenceBlock name=\"checkout.cart.coupon\" remove=\"true\"\/>\n    &lt;\/body>\n&lt;\/page><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019d be very grateful if you share this helpful post on social media to fellow developers!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2 store designs must constantly be updated based on the business requirements, latest trends, and for the improvement of customer experience. As a part&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-553","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=553"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/553\/revisions"}],"predecessor-version":[{"id":15309,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/553\/revisions\/15309"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}