I edited this file [vendor]/[theme name]/Magento_Checkout/layout/checkout_index_index.xml and use this code to hide the static block:

<block name="custom.block.header" remove="true"/>

The error output was something along the lines :

Element with ID'custom.block.header' already exists

What am I doing wrong here?

this is the full code

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="empty" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<move element="logo" destination="porto_header" />
<referenceBlock name="custom.block.header" remove="true"/>
  • Please share your xml file full code – Rakesh Jesadiya Oct 17 '16 at 7:15

This is how we remove a block in magento 2

<referenceBlock name="custom.block.header" remove="true"/>

full eg.

<?xml version="1.0"?>
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="footer_links" remove="true"/>

I would highly suggest, not to make changes in core files, create/extend default theme and make changes there.

  • I tried this, the error is gone but the block is still there, even after I did cache clearing . I am extending the file i custom theme. – Ree Oct 17 '16 at 5:54
  • what do you want to remove exactly. – Arun Karnawat Oct 17 '16 at 5:56
  • a static-block in checkout page, i extend the file in this path Theme Vendor /Magento_Checkout/layout/checkout_index_index.phtml – Ree Oct 17 '16 at 6:01
  • I think you are doing something wrong there can not be a phtml file in layout folder. it should be /Magento_Checkout/layout/checkout_index_index.xml – Arun Karnawat Oct 17 '16 at 6:04
  • this is the file you should be making changes to <MagentoRoot>/app/design/frontend/<Vendor>/<ThemeName>/Magento_Checkout\layout\checkout_index_index.xml – Arun Karnawat Oct 17 '16 at 6:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.