Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix incorrect assigment of the shipping address (#15694)

Maciej Korycinskie0db9b3ddb9a
diff --git a/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py b/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py
index b07aae6049..2b785d976a 100644
--- a/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py
+++ b/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py
@@ -256,8 +256,8 @@ class CheckoutDeliveryMethodUpdate(BaseMutation):
and collection_point.click_and_collect_option
== WarehouseClickAndCollectOption.LOCAL_STOCK
):
- checkout.shipping_address = collection_point.address
- checkout_info.shipping_address = collection_point.address
+ checkout.shipping_address = collection_point.address.get_copy()
+ checkout_info.shipping_address = checkout.shipping_address
checkout_fields_to_update += ["shipping_address"]
invalidate_prices_updated_fields = invalidate_checkout(
checkout_info, lines, manager, save=False
diff --git a/saleor/graphql/checkout/tests/mutations/test_checkout_delivery_method_update.py b/saleor/graphql/checkout/tests/mutations/test_checkout_delivery_method_update.py
index 6a9f7f01f9..c806867976 100644
--- a/saleor/graphql/checkout/tests/mutations/test_checkout_delivery_method_update.py
+++ b/saleor/graphql/checkout/tests/mutations/test_checkout_delivery_method_update.py
@@ -553,6 +553,7 @@ def test_checkout_delivery_method_update_valid_method_not_all_shipping_data_for_
)
errors = data["errors"]
assert checkout.shipping_address == delivery_method.address
+ assert checkout.shipping_address_id != delivery_method.address.id
assert not errors
assert getattr(checkout, attribute_name) == delivery_method