diff --git a/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php b/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php index 515c65096..a8a76352c 100644 --- a/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php +++ b/packages/Webkul/Discount/src/Actions/Cart/FixedAmount.php @@ -92,7 +92,13 @@ class FixedAmount extends Action $report['item_id'] = $item->id; $report['product_id'] = $item->child ? $item->child->product_id : $item->product_id; - $report['discount'] = $discount; + + if ($discount <= $itemPrice) { + $report['discount'] = $discount; + } else { + $report['discount'] = $itemPrice; + } + $report['formatted_discount'] = core()->currency($discount); $impact->push($report); diff --git a/packages/Webkul/Discount/src/Actions/Cart/PercentOfProduct.php b/packages/Webkul/Discount/src/Actions/Cart/PercentOfProduct.php index 74c9fa10c..1ad74a6c8 100644 --- a/packages/Webkul/Discount/src/Actions/Cart/PercentOfProduct.php +++ b/packages/Webkul/Discount/src/Actions/Cart/PercentOfProduct.php @@ -100,7 +100,13 @@ class PercentOfProduct extends Action $report['item_id'] = $item->id; $report['product_id'] = $item->child ? $item->child->product_id : $item->product_id; - $report['discount'] = $discount; + + if ($discount <= $itemPrice) { + $report['discount'] = $discount; + } else { + $report['discount'] = $itemPrice; + } + $report['formatted_discount'] = core()->currency($discount); $impact->push($report); diff --git a/packages/Webkul/Discount/src/Actions/Cart/WholeCartToPercent.php b/packages/Webkul/Discount/src/Actions/Cart/WholeCartToPercent.php index 40b764d8b..60037f191 100644 --- a/packages/Webkul/Discount/src/Actions/Cart/WholeCartToPercent.php +++ b/packages/Webkul/Discount/src/Actions/Cart/WholeCartToPercent.php @@ -54,7 +54,13 @@ class WholeCartToPercent extends Action $report['item_id'] = $item->id; $report['product_id'] = $item->child ? $item->child->product_id : $item->product_id; - $report['discount'] = $discount; + + if ($discount <= $itemPrice) { + $report['discount'] = $discount; + } else { + $report['discount'] = $itemPrice; + } + $report['formatted_discount'] = core()->currency(round($discount, 4)); $impact->push($report); @@ -77,7 +83,13 @@ class WholeCartToPercent extends Action $report['item_id'] = $item->id; $report['product_id'] = $item->child ? $item->child->product_id : $item->product_id; - $report['discount'] = $discount; + + if ($discount <= $itemPrice) { + $report['discount'] = $discount; + } else { + $report['discount'] = $itemPrice; + } + $report['formatted_discount'] = core()->currency(round($discount, 4)); $impact->push($report);