Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Load prefetched lines again in recalculate_order
Anna Siwikcf4e145c9e48
diff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex bdb17f7664..34378b6e16 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -59,6 +59,10 @@ def recalculate_order(order, **kwargs):Voucher discount amount is recalculated by default. To avoid this, passupdate_voucher_discount argument set to False."""+ # do not use prefetched order lines, cause they might have changed+ if hasattr(order, '_prefetched_objects_cache'):+ order._prefetched_objects_cache.pop('lines', None)+prices = [line.get_total() for line in order]total = sum(prices, order.shipping_price)# discount amount can't be greater than order total