Here is my code for overriding vendor module template. when the page corresponding to this layout loads, it is fetching template file from vendor.after the refresh it is fetching from my custom module.Please help.

<referenceBlock name="items">
        <action method="setTemplate">
            <argument name="template" translate="true" xsi:type="string">My_Sales::order/create/items.phtml</argument>

Below layouts are to be overrided.

  • sales_order_create_index.xml
  • sales_order_create_load_block_items.xml
  • sales_order_create_load_block_data.xml
  • Hi, did you find anything to resolve this, im facing the same issue. Magento version: 2.3.1
    – Harshith S
    Sep 9 '19 at 4:34
  • i added respective code to all the above xml files and finally issue resolved
    – Max28
    Sep 18 '19 at 16:05

You should put this in module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="My_Sales" setup_version="0.0.1">
            <module name="Magento_Checkout" />

Its depends which module you trying rewrite file

  • I have already added Magento_Sales, dependent module in module.xml. Issue is when the page loads and displays,the changes done in custom template file is not getting reflected. after refreshing the same page, the changes are reflecting.
    – Max28
    Feb 13 '19 at 12:01
  • maybe first time it was cache? Feb 13 '19 at 12:07
  • i tried enabling template hints and checked.on first load,it shows vendor folder template file.then after refresh it showed custom module template.
    – Max28
    Feb 13 '19 at 12:08
  • This happens alternatively on each refresh
    – Max28
    Feb 13 '19 at 12:14
  • what is the magento version? Feb 13 '19 at 12:18

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.