Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Only try to find the maximum if there are values
Patryk Zawadzkif065ba95d494
diff --git a/product/models.py b/product/models.pyindex 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.priceif discounted:- modifier = max(get_product_discounts(self, **kwargs))- price += modifier+ discounts = list(get_product_discounts(self, **kwargs))+ if discounts:+ modifier = max(discounts)+ price += modifierreturn pricedef get_slug(self):