on 07-07-2016 10:52 PM
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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.