Skip to content

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

Stop auto-assigning default addresses to checkout. (#9933)

SzymJd5c3ec9b58a0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 93f213cb32..59380aa5e0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ All notable, unreleased changes to this project will be documented in this file.
### Other changes
- Fix inaccurate tax calculations - #9799 by @IKarbowiak
- Introduce plain text attribute - #9907 by @IKarbowiak
+- Stop auto-assigning default addresses to checkout - #9933 by @SzymJ
#### Saleor Apps
- Add webhooks `PAGE_TYPE_CREATED`, `PAGE_TYPE_UPDATED` and `PAGE_TYPE_DELETED` - #9859 by @SzymJ
diff --git a/saleor/graphql/checkout/mutations/checkout_create.py b/saleor/graphql/checkout/mutations/checkout_create.py
index de4b448fa5..e63237bef3 100644
--- a/saleor/graphql/checkout/mutations/checkout_create.py
+++ b/saleor/graphql/checkout/mutations/checkout_create.py
@@ -138,8 +138,6 @@ class CheckoutCreate(ModelMutation, I18nMixin):
return cls.validate_address(
data["shipping_address"], address_type=AddressType.SHIPPING
)
- if user.is_authenticated:
- return user.default_shipping_address
return None
@classmethod
@@ -148,8 +146,6 @@ class CheckoutCreate(ModelMutation, I18nMixin):
return cls.validate_address(
data["billing_address"], address_type=AddressType.BILLING
)
- if user.is_authenticated:
- return user.default_billing_address
return None
@classmethod
diff --git a/saleor/graphql/checkout/tests/test_checkout.py b/saleor/graphql/checkout/tests/test_checkout.py
index 788d234a72..e600862fa4 100644
--- a/saleor/graphql/checkout/tests/test_checkout.py
+++ b/saleor/graphql/checkout/tests/test_checkout.py
@@ -1165,16 +1165,8 @@ def test_checkout_create_logged_in_customer(user_api_client, stock, channel_USD)
checkout_user = new_checkout.user
customer = user_api_client.user
assert customer.id == checkout_user.id
- assert customer.default_shipping_address_id != new_checkout.shipping_address_id
- assert (
- customer.default_shipping_address.as_data()
- == new_checkout.shipping_address.as_data()
- )
- assert customer.default_billing_address_id != new_checkout.billing_address_id
- assert (
- customer.default_billing_address.as_data()
- == new_checkout.billing_address.as_data()
- )
+ assert new_checkout.shipping_address is None
+ assert new_checkout.billing_address is None
assert customer.email == new_checkout.email