Cannot remove specific block named:
product.info.options.configurable
In Magento 2. This is the layout file I'm trying to change:
vendor/magento/module-configurable-product/view/frontend/layout/catalog_product_view_type_configurable.xml
The content of it is:
<!--
/**
* Copyright © Magento, Inc. 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">
<body>
<attribute name="class" value="page-product-configurable"/>
<referenceBlock name="head.components">
<block class="Magento\Framework\View\Element\Js\Components" name="configurableproduct_product_view_head_components" template="Magento_ConfigurableProduct::js/components.phtml"/>
</referenceBlock>
<referenceContainer name="product.info.type">
<block class="Magento\ConfigurableProduct\Block\Product\View\Type\Configurable" name="product.info.configurable" as="product_type_data" template="Magento_Catalog::product/view/type/default.phtml"/>
<container name="product.info.configurable.extra" after="product.info.configurable" as="product_type_data_extra" label="Product Extra Info">
<block class="Magento\ConfigurableProduct\Block\Stockqty\Type\Configurable" name="product.info.configurable.extra.catalog_inventory_stockqty_composite" template="Magento_CatalogInventory::stockqty/composite.phtml"/>
</container>
</referenceContainer>
<referenceBlock name="product.info.options.wrapper">
<block class="Magento\ConfigurableProduct\Block\Product\View\Type\Configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="Magento_ConfigurableProduct::product/view/type/options/configurable.phtml"/>
</referenceBlock>
</body>
</page>
As you can see the last part is:
<referenceBlock name="product.info.options.wrapper">
<block class="Magento\ConfigurableProduct\Block\Product\View\Type\Configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="Magento_ConfigurableProduct::product/view/type/options/configurable.phtml"/>
</referenceBlock>
I am sure that my code is correct as:
<referenceBlock name="product.info.options.wrapper" remove="true"/>
Can successfully remove the wrapper block and I can see it removed. This shows me that: Magento is correct. My layout file is read by Magento. Cache clear works. generated code clearing works. The way I'm writing that single line also works as it really removes the wrapper block. My operating system version, Magento subversion, composer, IDE, PHP and other things versions are also irrelevant as the remove command works for the above block. But then, when I try:
<referenceBlock name="product.info.options.configurable" remove="true"/>
It just doesn't work. I then put all possible combinations of lines to remove this which I found on every single forum I could search and it still doesn't remove the block I want:
<referenceBlock name="options_configurable" remove="true"/>
<referenceBlock name="product.info.options.configurable" remove="true"/>
<referenceBlock name="options_configurable" display="false"/>
<referenceBlock name="product.info.options.configurable" display="false"/>
<referenceContainer name="product.info.options.wrapper">
<referenceBlock name="options_configurable" remove="true"/>
<referenceBlock name="product.info.options.configurable" remove="true"/>
<referenceBlock name="options_configurable" display="false"/>
<referenceBlock name="product.info.options.configurable" display="false"/>
</referenceContainer>
<referenceBlock name="product.info.options.wrapper">
<referenceBlock name="options_configurable" remove="true"/>
<referenceBlock name="product.info.options.configurable" remove="true"/>
<referenceBlock name="options_configurable" display="false"/>
<referenceBlock name="product.info.options.configurable" display="false"/>
</referenceBlock>
<referenceContainer name="content">
<referenceBlock name="options_configurable" remove="true"/>
<referenceBlock name="product.info.options.configurable" remove="true"/>
<referenceBlock name="options_configurable" display="false"/>
<referenceBlock name="product.info.options.configurable" display="false"/>
</referenceContainer>
As you can see, I used all possible options. The block name, It's alias, remove="true"
, display="false"
, inside wrapper block, inside wrapper block as a container, each of above lines alone, a combination of above lines, and so on and so on.
Any ideas are highly appreciated. Thanks in advance.