customer
A customer of the store. When a customer is logged into their account, the customer object can be accessed globally. If the customer is not logged in, the object is only defined within the following contexts:
- The template customers/account
- The template customers/addresses
- The template customers/order
Outside of these scenarios, if the customer is not logged in or the corresponding context does not exist, the customer object returns nil.
Check if the customer object exists
When using the customer object in a template or object where its existence is not certain, it is advisable to first check if the customer object exists.
{{#if customer }}
Hello, {{ customer.first_name }}!
{{/if}}
Properties
Whether the customer has subscribed to email marketing.
true: Subscribedfalse: Not subscribed
Whether the customer has subscribed to SMS marketing.
true: Subscribedfalse: Not subscribed
All personal shipping addresses of the customer, limited to a maximum of 50 addresses.
The number of personal shipping addresses for the customer.
Value range: 0-50
Whether the customer is a B2B customer.
true: A B2B customerfalse: Not a B2B customer
To learn about B2B functionality, refer to B2B Company.
A list of company locations accessible to the customer.
To learn about B2B functionality, refer to B2B Company.
The company information currently selected by the customer.
To learn about B2B functionality, refer to B2B Company.
The company location currently selected by the customer.
To learn about B2B functionality, refer to B2B Company.
Whether the customer has applied to delete the account.
true: Appliedfalse: Not applied
The timestamp when the customer account will be deleted. You can format the time using the date filter.
The default personal shipping address of the customer.
The customer's email address. Returns nil if the value is not set.
The customer's first name.
The customer's last name.
The third-party account information of the customer.
Whether the email address used by the customer during checkout is associated with a customer account.
true: The email address is associated with an existing customer account.false: The email address is not registered with the store.
The customer's ID.
The customer's full name.
All orders of the customer.
Displays the 10 most recent orders by default. You can use the get_pagination filter to set the number of orders shown per page.
The total number of orders for the customer.
The customer's phone number. Returns nil if the value is not set.
The international dialing code for the customer’s phone number.
A list of the customer's tags.
Whether the customer is tax exempt.
true: Tax-exemptfalse: Taxable
The total amount of all orders for the customer. You can format the amount using the money filter.
Whether the customer accepts marketing.
true: Acceptedfalse: Not accepted