Skip to content

Commit 39dfb2b

Browse files
author
Alexey Yakimovich
committed
MAGETWO-91769: Credit Memo - Wrong tax calculation! #10982
- Converting base order shipping amount for correct calculation;
1 parent bb65b43 commit 39dfb2b

File tree

1 file changed

+3
-3
lines changed
  • app/code/Magento/Sales/Model/Order/Creditmemo/Total

1 file changed

+3
-3
lines changed

app/code/Magento/Sales/Model/Order/Creditmemo/Total/Tax.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ public function collect(\Magento\Sales\Model\Order\Creditmemo $creditmemo)
7575
}
7676

7777
$isPartialShippingRefunded = false;
78+
$baseOrderShippingAmount = (float)$order->getBaseShippingAmount();
7879
if ($invoice = $creditmemo->getInvoice()) {
7980
//recalculate tax amounts in case if refund shipping value was changed
80-
if ($order->getBaseShippingAmount() && $creditmemo->getBaseShippingAmount() !== null) {
81-
$taxFactor = $creditmemo->getBaseShippingAmount() / $order->getBaseShippingAmount();
81+
if ($baseOrderShippingAmount && $creditmemo->getBaseShippingAmount() !== null) {
82+
$taxFactor = $creditmemo->getBaseShippingAmount() / $baseOrderShippingAmount;
8283
$shippingTaxAmount = $invoice->getShippingTaxAmount() * $taxFactor;
8384
$baseShippingTaxAmount = $invoice->getBaseShippingTaxAmount() * $taxFactor;
8485
$totalDiscountTaxCompensation += $invoice->getShippingDiscountTaxCompensationAmount() * $taxFactor;
@@ -104,7 +105,6 @@ public function collect(\Magento\Sales\Model\Order\Creditmemo $creditmemo)
104105
}
105106
} else {
106107
$orderShippingAmount = $order->getShippingAmount();
107-
$baseOrderShippingAmount = $order->getBaseShippingAmount();
108108

109109
$baseOrderShippingRefundedAmount = $order->getBaseShippingRefunded();
110110

0 commit comments

Comments
 (0)