From b96e45a8e189b3bd5bdeee289180f80bbd4a076c Mon Sep 17 00:00:00 2001 From: Jaseel P V Date: Tue, 13 Oct 2020 22:37:02 +0530 Subject: [PATCH] Added checks for discount and flat case --- packages/Webkul/Product/src/Type/AbstractType.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/Webkul/Product/src/Type/AbstractType.php b/packages/Webkul/Product/src/Type/AbstractType.php index 0b3e5a7a8..be75cb2e5 100644 --- a/packages/Webkul/Product/src/Type/AbstractType.php +++ b/packages/Webkul/Product/src/Type/AbstractType.php @@ -660,13 +660,15 @@ abstract class AbstractType } if ($price->value_type == 'discount') { - $lastPrice = $product->price - ($product->price * $price->value) / 100; + if ($price->value >= 0 && $price->value <= 100) { + $lastPrice = $product->price - ($product->price * $price->value) / 100; - $lastQty = $price->qty; + $lastQty = $price->qty; - $lastCustomerGroupId = $price->customer_group_id; + $lastCustomerGroupId = $price->customer_group_id; + } } else { - if ($price->value < $lastPrice) { + if ($price->value >= 0 && $price->value < $lastPrice) { $lastPrice = $price->value; $lastQty = $price->qty;