2

Is there any method to differentiate between a shipping and billing address in Commerce once a customer has gone through a checkout? I ask because if they come back to their account and want to review their attached addresses and edit them, we want to be able to display them as a Shipping Address and a Billing Address. But from the docs, it appears you can only loop through all addresses with no way to really differentiate them beyond their ID.

This is a pretty common scenario in B2B stores where there may be different shipping addresses for different outlets but one billing address for the head office.

1

Not simple at the moment. This is because a single address could be used for both shipping and billing on an order during checkout.

You could subvert an existing address field you don't utilize (like attention or title) to store their preference, but that's pretty hacky.

If the user is logged in you have access to their last used shipping and billing addresses with:

{{ craft.commerce.customer.lastUsedBillingAddress ?? '' }}
{{ craft.commerce.customer.lastUsedshippingAddress ?? '' }}

Do you think an address.usedAs field would be useful? It would likely store something like: billing, shipping, or both. Thoughts?

| improve this answer | |
  • Thanks Luke. A 'usedAs' field as you describe is precisely the kind of thing that would solve this issue. It would especially be useful in B2B scenarios where there could be many Shipping Addresses and only one Billing Address - and we need to know which is which. – Mike Mar 8 '17 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.