A customer record is created for both guests and registered users. It is used to store information about the user.
You can get the current customer model in your templates with:
{% set customer = craft.commerce.getCustomer() %}
If the current customer is a guest, then the userId
attribute will be null.
If you need to access the email address of the customer, do so from the order with order.email
.
If you add the Customer Info field to the user profile, you can get the user’s related customer model returned for that user.
Returns a User Element if the customer is logged in, or null
if the customer is a guest.
Returns an array of Address Models
Returns an array of completed Order Models
Returns the User ID associated with this customer if the customer is a registered user.
Returns the last used shipping address. Returns null
if there is not a last used address.
Returns the last used billing address. Returns null
if there is not a last used address.