QuillObjects
Address
The address object used by customers, orders, and the store.
The address object holds a street address. You will find it on customers, orders, and the store itself. The fields are the same in each case, so you only need to learn them once.
Properties
| Property | Type | Description |
|---|---|---|
address.id | number | The unique address ID |
address.first_name | string | Recipient first name |
address.last_name | string | Recipient last name |
address.name | string | Combined first and last name |
address.company | string | Company name |
address.address1 | string | Street line 1 |
address.address2 | string | Street line 2 |
address.street | string | Combined address1 and address2 |
address.city | string | City |
address.province | string | County, state, or province |
address.province_code | string | Province abbreviation (e.g. CA, NY) |
address.zip | string | Postal code or ZIP code |
address.country | string | Country name |
address.country_code | string | Country ISO code (e.g. GB, US) |
address.phone | string | Phone number |
Displaying an address
<p>
{{ address.first_name }} {{ address.last_name }}<br />
{% if address.company %}{{ address.company }}<br />{% endif %}
{{ address.address1 }}<br />
{% if address.address2 != blank %}{{ address.address2 }}<br />{% endif %}
{{ address.city }}, {{ address.province_code }} {{ address.zip }}<br />
{{ address.country }}
</p>Customer address list
Loop over a customer's saved addresses:
{% for address in customer.addresses %}
<div class="address-card">
<p>{{ address.name }}</p>
<p>{{ address.street }}, {{ address.city }}</p>
<p>{{ address.zip }}, {{ address.country }}</p>
{% if address.phone %}
<p>{{ address.phone }}</p>
{% endif %}
</div>
{% endfor %}Default address
The customer's default address is available directly:
{% if customer.default_address %}
<h3>Default address</h3>
<p>{{ customer.default_address.street }}</p>
<p>{{ customer.default_address.city }}, {{ customer.default_address.zip }}</p>
{% endif %}Order addresses
Orders have both a shipping and billing address:
<div class="addresses">
<div>
<h4>Shipping</h4>
<p>{{ order.shipping_address.name }}</p>
<p>{{ order.shipping_address.address1 }}</p>
<p>{{ order.shipping_address.city }}, {{ order.shipping_address.zip }}</p>
</div>
<div>
<h4>Billing</h4>
<p>{{ order.billing_address.name }}</p>
<p>{{ order.billing_address.address1 }}</p>
<p>{{ order.billing_address.city }}, {{ order.billing_address.zip }}</p>
</div>
</div>