Skip to content

Commit 62f3450

Browse files
committed
Tax in sales order email is displayed after grand total row
1 parent 9475ecd commit 62f3450

File tree

1 file changed

+8
-7
lines changed
  • app/code/Magento/Tax/Block/Sales/Order

1 file changed

+8
-7
lines changed

app/code/Magento/Tax/Block/Sales/Order/Tax.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@ public function initTotals()
8686
$allowTax = $this->_source->getTaxAmount() > 0 || $this->_config->displaySalesZeroTax($store);
8787
$grandTotal = (double)$this->_source->getGrandTotal();
8888
if (!$grandTotal || $allowTax && !$this->_config->displaySalesTaxWithGrandTotal($store)) {
89-
$taxTotal = new \Magento\Framework\DataObject(['code' => 'tax', 'block_name' => $this->getNameInLayout()]);
90-
$totals = $this->getParentBlock()->getTotals();
91-
if ($totals['grand_total']) {
92-
$this->getParentBlock()->addTotalBefore($taxTotal, 'grand_total');
93-
}
89+
$this->_addTax();
9490
}
9591

9692
$this->_initSubtotal();
@@ -109,6 +105,10 @@ public function initTotals()
109105
protected function _addTax($after = 'discount')
110106
{
111107
$taxTotal = new \Magento\Framework\DataObject(['code' => 'tax', 'block_name' => $this->getNameInLayout()]);
108+
$totals = $this->getParentBlock()->getTotals();
109+
if ($totals['grand_total']) {
110+
$this->getParentBlock()->addTotalBefore($taxTotal, 'grand_total');
111+
}
112112
$this->getParentBlock()->addTotal($taxTotal, $after);
113113
return $this;
114114
}
@@ -273,12 +273,13 @@ protected function _initShipping()
273273
* Init discount.
274274
*
275275
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
276+
*
276277
* @return void
277278
*/
278279
protected function _initDiscount()
279280
{
280281
}
281-
282+
//phpcs:enable
282283
/**
283284
* Init grand total.
284285
*
@@ -319,8 +320,8 @@ protected function _initGrandTotal()
319320
]
320321
);
321322
$parent->addTotal($totalExcl, 'grand_total');
322-
$this->_addTax('grand_total');
323323
$parent->addTotal($totalIncl, 'tax');
324+
$this->_addTax('grand_total');
324325
}
325326
return $this;
326327
}

0 commit comments

Comments
 (0)