Skip to content

Commit

Permalink
fix: Resolve Calculator::getDiscountableAmount incongruity
Browse files Browse the repository at this point in the history
OrderItem::DiscountableAmount is on a per-unit basis, whereas Calculator::getDiscountableAmount relies on an OrderItem::Total equivalent value.
  • Loading branch information
benjicarson committed Nov 17, 2021
1 parent 9da7894 commit cafdce9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Calculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected function getDiscountableAmount($discount)
foreach ($this->order->Items() as $item) {
if (ItemDiscountConstraint::match($item, $discount)) {
$amount += $item->hasMethod('DiscountableAmount') ?
$item->DiscountableAmount() :
$item->DiscountableAmount() * $item->Quantity :
$item->Total();
}
}
Expand Down

0 comments on commit cafdce9

Please sign in to comment.