cancel
Showing results for 
Search instead for 
Did you mean: 

How to Differentiate Delivery Address from Billing Address When the Same

Former Member
0 Kudos

I would like to display the billing address on the order summary page only if it is different than the delivery address. However, even if you have only one address and select to use your delivery address for billing, the cartData.deliveryAddress.id is different from the cartData.paymentInfo.billingAddress.id.

So, what is the best way to differentiate the delivery address from the billing address? An equals check using the primary AddressData fields - i.e. first name, last name, line1 etc?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Easy solution would be add a flag to billing address / shipping address form.

So that on the storefront when customer is filling the address forms ( let's say for example customer fills the billing address form first and then the delivery address ) the first field on the billet address will be the flag that says

"is delivery same as billing "

if the flag is set to true ( copy the address from the billing form through Java script and disable editing on those fields)

we can store that flag and based on that we can drive the further logic.

else we should compare every field on address model.

Former Member
0 Kudos

There is a flag - useDeliveryAddress - unfortunately, it is not persisted on CartData so it gets lost in the multi-step checkout process. I ended up using the billing address as a way to determine if it was the same as the delivery address or not:

 <c:if
             test="${cartData.paymentInfo.billingAddress.shippingAddress eq cartData.paymentInfo.billingAddress.billingAddress}">
             <dt class="mess">
                 Shipping & Billing are the same<i class="icon-toolTip"></i>
             </dt>
         </c:if>
 
     </dl>
     
     <c:if test="${cartData.paymentInfo.billingAddress.shippingAddress ne cartData.paymentInfo.billingAddress.billingAddress}">
         <multi-checkout:reviewBillingAddress cartData="${cartData}" />
     </c:if>
Former Member
0 Kudos

Hi Bryan

On the address fields for both payment address in the payment info and Delivery address we have OOTB flags that determine the type of Address. like

The above image is from the delivery address.

We can use those flags to determine the address type even though they are same.

Former Member
0 Kudos

But what I am wanting to do is only display the Billing Address on the Order Summary page if in fact it is a different address than Shipping. Meaning, I do not want to duplicate the address on the Order Summary page if both are the same.