I’m working on the Profile Tab for my customer portal, but I’m struggling to figure out how to allow users to set/edit their shipping and billing address.
I’m following the guide from this website: https://shopify.dev/docs/themes/theme-templates/customers-addresses-liquid#form-attributes, and I have figured out how to edit the addresses given by the array customer.addresses using the form tag, but I’m still not sure how to access specifically the shipping and billing address. Does anyone have any suggestions/resources that I can use? Thanks in advance!
The Customerresource in Shopify does not have a property or field for “address type”, so if a customer has multiple addresses on file in their account there really isn’t an easy way to distinguish which address is for meant billing and which address is meant for shipping. Technically the Orderresource in Shopify does have a concept of separate addresses for billing and shipping - both of which are usually defined on the checkout page when a customer places an order.
As you’ve found, you can access a customer’s addresses using the Customerobject in Liquid, but there’s nothing in the customer’s address data that tells you if the address is a billing address or a shipping address. If you use the Orderobject in Liquid you can access the billing and shipping addresses for a specific order, but from my understanding you cannot allow a customer to edit these order addresses without the use of an API, and even then I believe that the order’s billing address is non-editable since it’s attached to the payment method that was used for the order.