CustomerAddress - Liquid Object Reference
On this page
Description
The CustomerAddress object is one entry in a customer’s address book. Reach the list through current_customer.addresses, which returns only the signed-in customer’s saved entries. The address book belongs to the contact rather than the account, so colleagues on one account never see each other’s entries.
```liquid
{% for entry in current_customer.addresses %}
{{ entry.label | default: entry.address.city }} {% if entry.is_default_shipping? %}(default shipping){% endif %} Edit
{% endfor %} ```
Attributes
| Attribute | Type | Description |
|---|---|---|
address |
Address | The address itself. See Address - Liquid Object Reference |
contact |
Contact | The Contact this entry belongs to |
edit_path |
String | Path to the page that displays the edit form for this entry |
id |
String | The unique id for this entry |
is_default_billing? |
Boolean | Returns true when this is the contact’s default billing address |
is_default_shipping? |
Boolean | Returns true when this is the contact’s default shipping address |
label |
String | An optional label the customer gave the entry, such as Home or Warehouse |
path |
String | Path to this entry, which a form posts to in order to update or delete it |
The address fields sit on the nested address attribute, not at the top level, so a book entry and a cart or order address expose the same field surface for the same data. Read entry.address.street and entry.address.city, and only the entry’s own metadata directly on the entry.
Available on
- Contact - Liquid Object Reference —
addresses
Pre-filling a form
Use current_customer.preferred_shipping_address and current_customer.preferred_billing_address to pre-fill an address form. They return the customer’s default entry for that type, or the account’s own address when the customer has no default. This is also the only way the account’s own address reaches a theme.
They are not CustomerAddress objects. They return a plain Address with no id, label or contact, and they never return nil, so you do not need to check whether they are present.
```liquid
{% assign ship_to = current_customer.preferred_shipping_address %} ```
:::note
A theme cannot tell whether the customer set an explicit default. preferred_shipping_address returns the same shape either way, and there are no default_shipping_address or default_billing_address attributes on the customer, so a template cannot prompt a customer to set a default address.
:::
Was this article helpful?
Thanks for your feedback! It helps us improve our docs.