I want to remove a block from the layout in magento 2 that is declared in a third party extension, but the block does not have a name.
Can I do that?
The block is declared like this
<referenceContainer name="before.body.end">
<block class="Magento\Backend\Block\Template" template="[Vendor_Module]::template.phtml"/>
</referenceContainer>
I cannot use
<referenceBlock name="..." remove="true" />
because, as you can see there is no name on it.
Best Answer
I found this issue in class
Magento\Framework\View\Layout\ScheduledStructure\Helper
There is function
_generateAnonymousName
:It's call from
scheduleStructure
function:With this case, Block name can be:
before.body.end_schedule_block1
before.body.end_schedule_block2
I think you should define totals block without the name on container and order block name need remove on the container.