1

SCENARIO:

  • I'm trying to hide the quantity field of my products frontend.
  • So I go to 'app/design/frontend/Magento/luma/Magento_Catalog/layout/catalog_product_view.xml'
  • And I try to hide it with:

    <referenceContainer name="product.add.form">
       <referenceBlock name="field.qty" remove="true"/>
    </referenceContainer>
    

And it doesn't do anything. So I'm trying to figure out what's the right combination of referenceContainer/Block to hide it.

MY QUESTION IS: What's the correct way to search for the container I want to hide? There's some way to figure out what's the correct one? Than you.

EDIT: I've found this but it doesn't seem to work with PHP 7.2.24 and/or magento 2.3.3.

0

1) For removing a Block (using remove="true") you do not need to mention the exact referenceContainer name. just write the code inside referenceContainer name="content"

<referenceContainer name="content">
   <referenceBlock name="field.qty" remove="true"/>
</referenceContainer>

2) To find out what are the referenceContainer available , you may try to create a CMS widget from admin panel.

In widget creation page you will get the list of referenceContainer to select from under "Layout Updates" tab. In that way you may sure what referenceContainer are available in your theme.

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.