diff --git a/app/code/Magento/Tax/Model/Plugin/OrderSave.php b/app/code/Magento/Tax/Model/Plugin/OrderSave.php index 3c87086cdf58..a1a3ebf861d6 100644 --- a/app/code/Magento/Tax/Model/Plugin/OrderSave.php +++ b/app/code/Magento/Tax/Model/Plugin/OrderSave.php @@ -97,8 +97,12 @@ protected function saveOrderTax(\Magento\Sales\Api\Data\OrderInterface $order) } else { $percentSum = 0; foreach ($taxRates as $rate) { - $realAmount = $rates['amount'] * $rate['percent'] / $rates['percent']; - $realBaseAmount = $rates['base_amount'] * $rate['percent'] / $rates['percent']; + $percentSum += $rate['percent']; + } + + foreach ($taxRates as $rate) { + $realAmount = $rates['amount'] * $rate['percent'] / $percentSum; + $realBaseAmount = $rates['base_amount'] * $rate['percent'] / $percentSum; $ratesIdQuoteItemId[$rates['id']][] = [ 'id' => $taxesArray['item_id'], 'percent' => $rate['percent'], @@ -110,7 +114,6 @@ protected function saveOrderTax(\Magento\Sales\Api\Data\OrderInterface $order) 'real_amount' => $realAmount, 'real_base_amount' => $realBaseAmount, ]; - $percentSum += $rate['percent']; } } }