0

I am trying to override module-sales/view/frontend/templates/email/creditmemo/items.phtml file but no changes appearing.

Is their any way i can override it in my module ?

Thankyou

1
  • Any thoughts appreciated – dev php Feb 15 at 5:38
2

Try:-

create a sales_email_order_creditmemo_items.xml

path:-

app/code/Vendor/Module/view/frontend/layout/sales_email_order_creditmemo_items.xml

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
    <referenceBlock name="items">
        <action method="setTemplate">
<argument name="template" xsi:type="string">Vendor_Module::email/creditmemo/items.phtml</argument>
        </action>
    </referenceBlock>
</layout>
1
  • Hello @Himanshu what to write in layout file for overriding block class="Magento\Sales\Block\Order\Creditmemo\Totals" name="creditmemo_totals" template="Magento_Sales::order/totals.phtml" cacheable="false"> phtml file ? – dev php Feb 15 at 6:07
0

Please go to your theme and create folder Magento_Sales/templates/email/creditmemo

then download items.phtml file

from /vendor/magento/module-sales/view/frontend/templates/email/creditmemo/

then paste here Magento_Sales/templates/email/creditmemo your theme.

EDIT IF you want to override the template in the custom module, create a new layout file at below location :

<Vendor>_<Module>/view/frontend/layout/sales_email_order_creditmemo_items.xml


<?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="items">
            <arguments>
                <argument name="template" xsi:type="string">Vendor_Module::items.phtml</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>
1
  • Hi, i am using module so i need to override it in module. – dev php Feb 15 at 5:47

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.