2

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

2
  • Do you want to change it in order emails right?
    – Sumit
    Commented Sep 16, 2019 at 12:04
  • Hi sumit, yes i do
    – Brian NN
    Commented Sep 16, 2019 at 12:06

1 Answer 1

3

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.

Ex. override theme:

app/design/frontend/Smartwave/porto_child/Magento_Sales/templates/order/totals.phtml

Hope it helps!!!

10
  • I tried, but it also changed the frontend, I just wanted to change it in the email
    – Brian NN
    Commented Sep 16, 2019 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
    Commented Sep 16, 2019 at 12:35
  • 1
    Sure, I might have to ask you to help with this matter again
    – Brian NN
    Commented Sep 16, 2019 at 12:58
  • 1
    Its worked for me
    – matinict
    Commented Apr 2, 2020 at 12:10
  • 1
    Excellent answer!
    – nuwaus
    Commented Mar 22, 2023 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.