Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Recalculate order with order's shipping price
Anna Siwike6e494452ca2
diff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex a541a95d8c..8e9ea1e5fc 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -38,12 +38,14 @@ def recalculate_order(order):"""Recalculates and assigns total price of order.Total price is a sum of items and shippings in order shipment groups."""prices = [- group.get_total_with_shipping() for group in order+ group.get_total() for group in orderif group.status != GroupStatus.CANCELLED]total_net = sum(p.net for p in prices)total_gross = sum(p.gross for p in prices)- order.total = Price(+ total = Price(net=total_net, gross=total_gross, currency=settings.DEFAULT_CURRENCY)+ total += order.shipping_price+ order.total = totalorder.save()