Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Order total always greater than or equal 0
Anna Siwikc9191ea8e183
diff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex 9457f2cf79..6790b6ee34 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -37,8 +37,9 @@ def recalculate_order(order, discount_amount=None):"""prices = [line.get_total() for line in order]total = sum(prices, order.shipping_price)- if discount_amount is not None:- order.discount_amount = discount_amount+ # discount amount can't be greater than order total+ order.discount_amount = min(+ discount_amount or order.discount_amount, total.gross)if order.discount_amount:total -= order.discount_amountorder.total = total