Edge case fix for Cart Rule actions

This commit is contained in:
Prashant Singh 2019-09-06 13:46:20 +05:30
parent c9cd73b67e
commit 6ca065544c
2 changed files with 2 additions and 6 deletions

View File

@ -58,9 +58,7 @@ class FixedAmount extends Action
$discount = round($itemPrice * $discQuantity, 4) * $discQuantity;
if ($rule->action_type == 'fixed_amount') {
$discount = $discount <= $itemPrice ? $discount : $itemPrice;
}
$discount = $discount <= $itemPrice * $discQuantity ? $discount : $itemPrice * $discQuantity;
$report['discount'] = $discount;

View File

@ -71,9 +71,7 @@ class PercentOfProduct extends Action
$discount = round(($itemPrice * $discount_amount) / 100, 4) * $discQuantity;
if ($rule->action_type == 'percent_of_product') {
$discount = $discount <= $itemPrice ? $discount : $itemPrice;
}
$discount = $discount <= $itemPrice * $discQuantity ? $discount : $itemPrice * $discQuantity;
$report['discount'] = $discount;