Templates and layouts are building blocks of theme in Magento 2. Layouts are the XML files which defines the overall structure of a page. Overriding layout XML block in Magento 2 requires when you work with custom extension. There are 2 methods to override layout XML block in Magento 2 and here I will explain both in detail.
- Overriding XML block with name attribute:
1Namespace_ExtensionName::order/invoice/view/items.phtml - Overriding XML block with child attribute:
Some XML blocks don’t have name or alias attribute where they cannot be override using above method. Here we can make use of overriding through child attribute.
12defaultcustom_renderer
Hope I have enough explained the code to nail the solution for layout block overriding in Magento. If you still have any queries, feel free to comment anytime. I’ll be glad to help you out.