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

  • Developer support
  • One year of updates ($199/year for updates after that)
  • 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, without any restrictions, as long as you’re running it from a development, testing, or staging domain.

Will there be recurring/upgrade fees?

Each Commerce license comes with one year of updates. After that, you can unlock additional updates for $199 per year.

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), you can purchase Craft Commerce directly from the Plugin Store or just leave the switch off that says “Include a Craft Pro license” in the purchase form.

Is Craft Pro required?

Craft Commerce does not require Craft Pro; it works perfectly fine on Craft Solo 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, without any restrictions, as long as you’re running it from a development, testing, or staging domain.

Will there be recurring/upgrade fees?

Each Commerce license comes with one year of updates. After that, you can unlock additional updates for $199 per year.

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), you can purchase Craft Commerce directly from the Plugin Store or just leave the switch off that says “Include a Craft Pro license” in the purchase form.

Is Craft Pro required?

Craft Commerce does not require Craft Pro; it works perfectly fine on Craft Solo as well!