Skip to content

Commit 1b935ca

Browse files
committed
[GraphQL] Cart query does not get individual taxes if multiple tax rules are configured
1 parent c22a9db commit 1b935ca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/code/Magento/QuoteGraphQl/Model/Resolver/CartPrices.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,15 @@ private function getAppliedTaxes(Total $total, string $currency): array
9898
$rates = [];
9999

100100
foreach ($appliedTaxes as $appliedTax) {
101+
$totalPercentage = $appliedTax['percent'];
101102
foreach ($appliedTax['rates'] as $appliedTaxRate) {
102103
$rateTitle = $appliedTaxRate['title'];
103104
if (!array_key_exists($rateTitle, $rates)) {
104105
$rates[$rateTitle] = 0.0;
105106
}
106-
$rates[$rateTitle] += $appliedTax['amount'];
107+
$percentage = $appliedTaxRate['percent'];
108+
$taxValue = ($percentage / $totalPercentage) * $appliedTax['amount'];
109+
$rates[$rateTitle] += round((float) $taxValue, 2);
107110
}
108111
}
109112

0 commit comments

Comments
 (0)