Skip to content

Commit 0628512

Browse files
committed
AC-8966::Bundle product does not show per item applied discounts
1 parent 6a5060a commit 0628512

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
6666
$this->totals = $this->totalsCollector->collectQuoteTotals($cartItem->getQuote());
6767
}
6868
$currencyCode = $cartItem->getQuote()->getQuoteCurrencyCode();
69+
70+
if ($cartItem->getProductType() == 'bundle') {
71+
$discountValues = $this->getDiscountValues($cartItem, $currencyCode);
72+
$discountAmount = 0;
73+
foreach ((array) $discountValues as $discountValue) {
74+
$discountAmount += $discountValue['amount']['value'];
75+
}
76+
} else {
77+
$discountAmount = $cartItem->getDiscountAmount();
78+
}
6979
return [
7080
'model' => $cartItem,
7181
'price' => [
@@ -86,7 +96,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
8696
],
8797
'total_item_discount' => [
8898
'currency' => $currencyCode,
89-
'value' => $cartItem->getDiscountAmount(),
99+
'value' => $discountAmount,
90100
],
91101
'discounts' => $this->getDiscountValues($cartItem, $currencyCode)
92102
];

0 commit comments

Comments
 (0)