customer

The customer object contains information about a customer who has a customer account.

Where and when is it defined

The customer object is global in the sense that you can access it in all layout, template and snippet files. However, the object is only defined when a customer is logged-in. You can verify if a customer is logged-in with this code:

{% if customer %}
  Customer is logged in. You can access the customer
  attributes such as {{ customer.first_name }}.
{% endif %}

Attributes

customer.email

Returns the email address of the customer.

customer.id

Returns the id of the customer.

customer.name

Returns the full name of the customer.


Did this page help you?