customer object
The logged in customer. It is available in every template, and it is nil when no customer is logged in.
Properties
| Name | Type | Description |
|---|---|---|
id | string | The customer id |
email | string | The email |
phone | string | The phone number, or nil |
first_name | string | The first name, or nil |
last_name | string | The last name, or nil |
name | string | The first and last name |
accepts_marketing | boolean | Whether the customer accepts marketing emails |
tags | array of string | The tags the seller added to the customer |
has_account | boolean | Whether the customer has an account |
orders_count | number | The number of orders |
total_spent | string | The total of all orders, in the store currency |
orders | array of order object | The orders, newest first, 50 at a time. Use paginate for more |
last_order | order object or null | The most recent order |
addresses | array of address object | The saved addresses, the default address first |
addresses_count | number | The number of saved addresses |
default_address | address object or null | The default address, or the first address when none is the default |
new_address | address object | An empty address for the form that adds an address |
liquid
{% if customer %}
<a href="{{ routes.account_url }}">{{ customer.first_name }}</a>
<a href="{{ routes.account_logout_url }}">Log out</a>
{% else %}
<a href="{{ routes.account_login_url }}">Log in</a>
{% endif %}Orders
{% paginate customer.orders by 10 %} paginates the orders. order.customer_url is the URL of the order page.
liquid
{% paginate customer.orders by 10 %}
{% for order in customer.orders %}
<a href="{{ order.customer_url }}">{{ order.name }}</a>
<span>{{ order.financial_status }}</span>
<span>{{ order.total | money }}</span>
{% endfor %}
{% endpaginate %}