Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update shipping price when order's prices are updateing
Maciej Korycinski445738233f01
diff --git a/saleor/core/taxes/avatax/interface.py b/saleor/core/taxes/avatax/interface.pyindex 558f0419fe..07630d43ec 100644--- a/saleor/core/taxes/avatax/interface.py+++ b/saleor/core/taxes/avatax/interface.py@@ -141,7 +141,6 @@ def apply_taxes_to_order_line_unit_price(order_line: "OrderLine", price: Money):def calculate_order_shipping(order: "Order"):if not validate_order(order) or not order.shipping_method:return ZERO_TAXED_MONEY-taxes_data = get_order_tax_data(order, None)for line in taxes_data.get("lines", []):if line["itemCode"] == "Shipping":diff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex 9e241eb833..4b89a45cd7 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -8,7 +8,10 @@ from prices import Money, TaxedMoneyfrom ..account.utils import store_user_addressfrom ..checkout import AddressTypefrom ..core.taxes import ZERO_MONEY-from ..core.taxes.interface import apply_taxes_to_order_line_unit_price+from ..core.taxes.interface import (+ apply_taxes_to_order_line_unit_price,+ calculate_order_shipping,+)from ..core.weight import zero_weightfrom ..dashboard.order.utils import get_voucher_discount_for_orderfrom ..discount.models import NotApplicable@@ -162,7 +165,7 @@ def update_order_prices(order, discounts):line.save()if order.shipping_method:- order.shipping_price = order.shipping_method.get_total()+ order.shipping_price = calculate_order_shipping(order)order.save()recalculate_order(order)