2

I am trying to override sales_order_view.xml file sales.order.items.renderers block, I have followed below mentioned code but not worked:

overriding sales_order_view.xml in custom module :

Method 1 :

 <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
            <referenceBlock name="order_items">
                <block class="Magento\Framework\View\Element\RendererList" name="sales.order.items.renderers" as="renderer.list" template="Vendor_Namespace::order/items/renderer/default.phtml"/>
            </referenceBlock>

        </body>
    </page>

Method 2 :

<?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
            <referenceBlock name="sales.order.items.renderers">
               <arguments>
                    <argument name="template" xsi:type="string">Vendor_Namespace::order/items/renderer/default.phtml</argument>
                </arguments>
            </referenceBlock>
        </body>
    </page>

Method 3 :

<?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
            <referenceBlock name="sales.order.items.renderers">
                <action method="setTemplate">
                   <argument name="template" xsi:type="string">Vendor_Namespace::order/items/renderer/default.phtml</argument>
               </action>
            </referenceBlock>
        </body>
    </page>

and I created order/items.renderer/default.phtml file in custom module, but it is not overriding.

Any help will appreciate.

1

You can use this

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="sales.order.items.renderers.default">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Namespace::order/items/renderer/default.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

Please use reference block name sales.order.items.renderers.default

Hope this will help you!

  • 1
    worked, thankyou :) – temper Nov 19 at 7:51
  • 1
    thankyou @Kishan :) – temper Nov 19 at 7:55
  • Always welcome :) – Kishan Savaliya Nov 19 at 7:56
0

Use this code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="sales.order.items.renderers">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Namespace::order/items/renderer/default.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>
  • please check my question, I already tried this one – temper Nov 19 at 7:29
  • Yes, but you do not write <referenceBlock name="sales.order.items.renderers">. Please check it in your question. – Dhaduk Mitesh Nov 19 at 7:30
  • sorry writing mistake here, question updated now. – temper Nov 19 at 7:31

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.