<p>It <em>is</em> possible to override sameAddress</p>

<p>The trick to doing this is as follows:</p>

<p>Checkout Step 1: Set your shipping address and use sameAddress1</p>

<pre><code>&lt;form method="POST"&gt;
    &lt;input type="hidden" name="action" value="commerce/cart/updateCart"&gt;
    &lt;input type="hidden" name="redirect" value="/checkout/shipping"&gt;
    &lt;input type="hidden" name="shippingAddressId" value="new"&gt;
    &lt;input type="hidden" name="sameAddress" value="1"&gt;

      shipping address fields here        

&lt;/form&gt;
</code></pre>

<p>Checkout Step 2: Set shipping method as normal</p>

<p>Checkout Step 3: Set the billing address, including the shipping address as hidden fields, set sameAddress to 0.</p>

<pre><code>&lt;form method="POST" id="paymentMethod"&gt;
    &lt;input type="hidden" name="action" value="commerce/cart/updateCart"&gt;
    &lt;input type="hidden" name="redirect" value="/checkout/payment"&gt;

    &lt;!-- billing fields --&gt;
    &lt;input type="text" name="billingAddress[firstName]" value="{{ cart.billingAddress ? cart.billingAddress.firstName }}"&gt;
    &lt;input type="text" name="billingAddress[lastName]" value="{{ cart.billingAddress ? cart.billingAddress.lastName }}"&gt;

    etc.
    &lt;!-- tell Craft this is a new billing address --&gt;
    &lt;input type="hidden" name="billingAddressId" value="new"&gt;

    &lt;!-- hidden shipping address fields --&gt;
    &lt;input type="hidden" name="shippingAddress[firstName]" value="{{ cart.shippingAddress.firstName }}"&gt;
    &lt;input type="hidden" name="shippingAddress[lastName]" value="{{ cart.shippingAddress.lastName }}"&gt;

    etc.
&lt;/form&gt;
</code></pre>

CC BY-SA 4.0
2018-07-31T15:09:17.077Z
2018-07-31T15:30:05.473Z
2018-07-31T15:30:05.473Z
foamcow
<p>I'm working on a new checkout process which involves taking the shipping address first. </p>

<p>To do this I am setting sameAddress to 1 in my shippingAddress form.</p>

<p>Then, at a later stage I want to offer the customer the option to change their billing address. I thought I could just present the customer with a new form for billingAddress fields and set sameAddress to 0, or false.</p>

<p>However, this doesn't seem to let me override the already stored billing address. It seems that once sameAddress is set, it cannot be unset.</p>

<p>I have tried setting a hidden billing address when setting the shipping address but again it's not letting me override that later.</p>

<p>Is there way I can achieve this checkout flow?</p>

<p>Shipping address info -> shipping method selection -> payment (with option to use a different address for billing)?</p>

<plugin-craftcommerce><addresses>
Override "sameAddress" option when updating cart
# Override "sameAddress" option when updating cart

(Asked by: username_0 on 2018-07-31)

I'm working on a new checkout process which involves taking the shipping address first.

To do this I am setting sameAddress to 1 in my shippingAddress form.

Then, at a later stage I want to offer the customer the option to change their billing address. I thought I could just present the customer with a new form for billingAddress fields and set sameAddress to 0, or false.

However, this doesn't seem to let me override the already stored billing address. It seems that once sameAddress is set, it cannot be unset.

I have tried setting a hidden billing address when setting the shipping address but again it's not letting me override that later.

Is there way I can achieve this checkout flow?

Shipping address info -> shipping method selection -> payment (with option to use a different address for billing)?

**Tags:** plugin-craftcommerce, addresses


---

## 1 answers

### Answer by username_0 on 2018-07-31. Score: 1 | Accepted answer

It is possible to override sameAddress
The trick to doing this is as follows:
Checkout Step 1: Set your shipping address and use sameAddress1

    
    
    
    

      shipping address fields here        



Checkout Step 2: Set shipping method as normal
Checkout Step 3: Set the billing address, including the shipping address as hidden fields, set sameAddress to 0.

    
    

    
    
    

    etc.
    
    

    
    
    

    etc.


---

