Magento 2 : Custom template file is loading after refreshing the page only?
-
18-02-2021 - |
Question
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>
</action>
</referenceBlock>
Solution
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
OTHER TIPS
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">
<sequence>
<module name="Magento_Checkout" />
</sequence>
</module>
</config>
Its depends which module you trying rewrite file
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange