Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
fixing bug no. 4134
MahmoudRizk7c6831fd19d7
diff --git a/saleor/product/utils/costs.py b/saleor/product/utils/costs.pyindex 79350bde14..75aebf0aa1 100644--- a/saleor/product/utils/costs.py+++ b/saleor/product/utils/costs.py@@ -58,5 +58,9 @@ def get_margin_for_variant(variant):return Nonebase_price = variant.base_pricemargin = base_price - variant.cost_price- percent = round((margin / base_price) * 100, 0)+ try:+ percent = round((margin / base_price) * 100, 0)+ except ZeroDivisionError:+ sign = lambda margin: (1, -1)[margin.amount < 0]+ percent = 9999999999999999999999 * sign(margin)return percent