1

I want to add some changes in Magento 2 email order_totals.

enter image description here

I searched and found it

<tfoot class="order-totals">
        <?= $block->getChildHtml('order_totals') ?>
</tfoot>

Where do I change it? Please help me

  • Do you want to change it in order emails right? – Sumit Sep 16 at 12:04
  • Hi sumit, yes i do – TN98 Sep 16 at 12:06
1

You can change the sort order of the totals by following the below path in the Magento admin.

Stores > Configurations > Sales > Sales > Checkout Totals Sort Order

If you want to change it only for the emails then you need to change the layout handle {{layout handle="sales_email_order_items" order=$order area="frontend"}} described in the email template which contains /vendor/magento/module-sales/view/frontend/layout/sales_email_order_items.xml file.

In this file, the total block is defined /vendor/magento/module-sales/view/frontend/templates/order/totals.phtml. You can override it as per your requirements.

Hope it helps!!!

  • I tried, but it also changed the frontend, I just wanted to change it in the email – TN98 Sep 16 at 12:32
  • This is because of all of the totals block is coming from the same file "/vendor/magento/module-sales/view/frontend/templates/order/totals.phtml". – Sumit Sep 16 at 12:35
  • I found and known that it is so, is there any way we can customize it? – TN98 Sep 16 at 12:37
  • I've updated my answer with an idea to override the totals block only for the order emails. – Sumit Sep 16 at 12:42
  • 1
    Sure, I might have to ask you to help with this matter again – TN98 Sep 16 at 12:58

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.