I have a template file that resides under app/design/frontend//theme/Magento_Sales/templates/order/email_invoice_totals.phtml As I understand, the business logic should not reside in those template files. Below is, I have the code for that phtml file. <?php use MagentoFrameworkEscaper; use MagentoSalesBlockOrderTotals; /** @var Totals $block */ /** @var Escaper $escaper */ $index = 0; […]