I'm stuck on this:
I need to remove the SKU field from product page only for few products, I'm sure that I can do it with "layout update XML" tab but all my attempts have failed.. any help? :)
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityTry this solution.
You have to mention the block container name also
<referenceContainer name="product.info.stock.sku"> <referenceBlock name="product.info.sku" remove="true" /> </referenceContainer>
Here,product.info.stock.sku
is the container name of your block.
<referenceContainer name="{CONTAINER_NAME_OF_BLOCK}"> <referenceBlock name="{BLOCK_NAME_AT_LAYOUT}" remove="true" /> </referenceContainer>
Create a new container
and Move your block to this container
After that remove container:
<container name="my.new.sections" htmlTag="div" /> <move element="product.info.sku" destination="my.new.sections" /> <referenceContainer name="my.new.sections" remove="true" />
<container name="{New_Conatiner_Name}" htmlTag="div" /> <move element="{BLOCK_NAME_AT_LAYOUT}" destination="{New_Conatiner_Name}" /> <referenceContainer name="{New_Conatiner_Name}" remove="true" />
Edit attributes and choose layout update.
Paste this:
<referenceBlock name="product.info.sku" remove="true" />
and save
Update: Add reference container around referenceBlock
<referenceContainer name="your container
">
Ref:
https://inchoo.net/magento-2/bypassing-magento-2-layout-update-restrictions-admin/