Skip to content

Commit 0f6f87d

Browse files
committed
Merge remote-tracking branch 'origin/AC-8966' into spartans_pr_19012024
2 parents 3b13903 + e09b1f2 commit 0f6f87d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ 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+
/** calculate bundle product discount */
71+
if ($cartItem->getProductType() == 'bundle') {
72+
$discountValues = $this->getDiscountValues($cartItem, $currencyCode);
73+
$discountAmount = 0;
74+
foreach ((array) $discountValues as $discountValue) {
75+
$discountAmount += $discountValue['amount']['value'];
76+
}
77+
} else {
78+
$discountAmount = $cartItem->getDiscountAmount();
79+
}
6980
return [
7081
'model' => $cartItem,
7182
'price' => [
@@ -86,7 +97,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
8697
],
8798
'total_item_discount' => [
8899
'currency' => $currencyCode,
89-
'value' => $cartItem->getDiscountAmount(),
100+
'value' => $discountAmount,
90101
],
91102
'discounts' => $this->getDiscountValues($cartItem, $currencyCode)
92103
];

0 commit comments

Comments
 (0)