Skip to content

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

Check if user wants to use another address for shipping

Artur Smęta92669753bec
diff --git a/saleor/checkout/steps.py b/saleor/checkout/steps.py
index aa1fd3c418..e2d8d14ffd 100644
--- a/saleor/checkout/steps.py
+++ b/saleor/checkout/steps.py
@@ -136,6 +136,7 @@ class ShippingStep(BaseAddressStep):
default_address=None):
self.cart = cart
address_data = storage.get('address', {})
+ self.billing_address = default_address
if not address_data and default_address:
address = default_address
else:
@@ -157,13 +158,19 @@ class ShippingStep(BaseAddressStep):
self.forms['delivery'] = DeliveryForm(
delivery_choices, request.POST or None,
initial={'method': selected_method_name})
+ self.shipping_same_as_billing = request.POST.get(
+ 'shipping_same_as_billing')
def __str__(self):
return 'shipping-address'
def save(self):
delivery_form = self.forms['delivery']
- self.storage['address'] = Address.objects.as_data(self.address)
+ if self.shipping_same_as_billing:
+ address = self.billing_address
+ else:
+ address = self.address
+ self.storage['address'] = Address.objects.as_data(address)
delivery_method = delivery_form.cleaned_data['method']
self.storage['delivery_method'] = delivery_method