Skip to content

Commit 93e72bb

Browse files
author
Andy Coates
committed
Make sure discounts with quantities > 1 are handled correctly
1 parent b314399 commit 93e72bb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Message/AbstractRequest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ protected function getItemData()
178178
}
179179
if ($cartHasDiscounts) {
180180
$discounts = $xml->addChild('discounts');
181-
foreach ($items as $discountItems) {
182-
if ($discountItems->getPrice() < 0) {
181+
foreach ($items as $discountItem) {
182+
if ($discountItem->getPrice() < 0) {
183183
$discount = $discounts->addChild('discount');
184-
$discount->addChild('fixed', $discountItems->getPrice() * -1);
185-
$discount->description = $discountItems->getName();
184+
$discount->addChild('fixed', ($discountItem->getPrice() * $discountItem->getQuantity()) * -1);
185+
$discount->description = $discountItem->getName();
186186
}
187187
}
188188
}

0 commit comments

Comments
 (0)