Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Only try to find the maximum if there are values

Patryk Zawadzkif065ba95d494
diff --git a/product/models.py b/product/models.py
index d42a0af1ec..5e0fd0f0dc 100644
--- a/product/models.py
+++ b/product/models.py
@@ -133,8 +133,10 @@ class Product(Subtyped, Item):
def get_price_per_item(self, discounted=True, **kwargs):
price = self.price
if discounted:
- modifier = max(get_product_discounts(self, **kwargs))
- price += modifier
+ discounts = list(get_product_discounts(self, **kwargs))
+ if discounts:
+ modifier = max(discounts)
+ price += modifier
return price
def get_slug(self):