Customer Model

Overview #

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.

Attributes #

user #

Returns a User Model if the customer is logged in, or null if the customer is a guest.

addresses #

Returns an array of Address Models

orders #

Returns an array of completed Order Models

userId #

Returns the User ID associated with this customer if the customer is a registered user.

lastUsedShippingAddress #

Returns the last used shipping address. Returns null if there is not a last used address.

lastUsedBillingAddress #

Returns the last used billing address. Returns null if there is not a last used address.

Buy Craft Commerce

Craft Commerce site license

Includes

  • Standard tech support
  • Unlimited app updates
  • Craft Pro site license
Buy now for $999
Can I try before buying?

Absolutely. Just download it from the “Download” button in the site header and follow our installation instructions. You’ll have the full feature set to experiment with, with just one limitation: you won’t be able to charge credit cards. Until Craft Commerce has been purchased and activated, it’s limited to a single dummy gateway.

Will there be recurring/upgrade fees?

Nope, it’s just a one-time license fee per site.

Can I use this on an existing Craft site?

Yes! And if you already have a Craft Pro license (or you don’t need one), just flip that “Include a Craft Pro license” switch in the purchase form, and we’ll drop the price to $700.

Is Craft Pro required?

Craft Commerce does not require Craft Pro; it works perfectly fine on Craft Client and Personal editions as well!

Can I try before buying?

Absolutely. Just download it from the “Download” button in the site header and follow our installation instructions. You’ll have the full feature set to experiment with, with just one limitation: you won’t be able to charge credit cards. Until Craft Commerce has been purchased and activated, it’s limited to a single dummy gateway.

Will there be recurring/upgrade fees?

Nope, it’s just a one-time license fee per site.

Can I use this on an existing Craft site?

Yes! And if you already have a Craft Pro license (or you don’t need one), just flip that “Include a Craft Pro license” switch in the purchase form, and we’ll drop the price to $700.

Is Craft Pro required?

Craft Commerce does not require Craft Pro; it works perfectly fine on Craft Client and Personal editions as well!