Skip to content

Customer profiles

Customer profiles contain collections of data required to process orders, whether it be billing information, shipping information, or other types of details. These customer profiles are not unique to a user, meaning a single user may have multiple instances of each type of profile. This allows us to use the data collected to provide address book functionality where a user has a default profile of each type but may create a unique profile for a given order or choose from other previously generated profiles.

Customer profiles come from three different locations:

  1. Checkout - each profile type has an associated checkout pane that allows the customer to enter their details on the checkout form. If a customer is not using a past profile or has modified a previously used profile in any way, a new profile is created using the values entered on the form. This profile is then related to the customer's order via a customer profile reference field.
  2. Order edit form - each profile type is also represented on orders via default customer profile reference fields. These reference fields are populated by the relevant checkout panes but may also be filled out by administrators on the order edit form. Profile creation works the same here as in Checkout.
  3. Customer profile administration - the main menu item that lists out all the customer profiles in a View has a local action link allowing administrators to create customer profiles. These are not linked to orders but may be associated with users to pre-populate orders and address books. Existing profiles can also be edited, but if a profile is currently referenced by any customer profile reference field, a new profile will be created for it upon save.

As indicated above, it is important for customer profiles to be preserved in the state they are in on any given order that references them to prevent data loss. The only exception is if a customer profile is being edited via a form that represents the only place a profile is being referenced. This logic will allow us to prevent unnecessary duplication of profile data while ensuring data relevant to previous orders is never lost.

Configuring / Creating Customer Profiles

Customer information is collected for orders on separate entities called customer profiles that are associated with the order through customer profile reference fields. By default the Billing information customer profile type just includes an address field, but it can be edited through the field interface to include any additional fields you require. These fields will automatically be visible on the related checkout pane for the customer profile.

Some modules define additional customer profile types, such as the Shipping information customer profile type defined in the Commerce Shipping module.

During a default checkout process, customers cannot reuse previously created customer profiles. A new customer profile will be saved each time, though modules like Commerce Addressbook seek to alleviate this problem with a nice UI. Customer profiles edited through the back-end UI may also result in duplicate customer profiles being saved to avoid the loss of data when a customer profile is edited that has been referenced by a previous order.

Adding and Editing a Customer Profile Field

We're going to do the following: Add a custom field to the Billing information customer profile type, such as phone number, and complete checkout with the new field. After completing checkout, go edit the newly created customer profile and save it to view the resulting message.

Go to Store, then click Customer Profiles.

Navigate to Store

Customer Profiles are a top-level configuration option in your store. Use this screenshot to help you find it.

  • Administration
  • Store

Let's add phone number

Click Manage Fields

The first tab you will find yourself on is the "List" tab. That will show you all of the available customer profiles. If you click "Profile Types" in the upper right, you will see all of your profile types (similar to content types for nodes). If you have installed Shipping, that includes a new profile type. Click Manage Fields to add a phone number.

  • Administration
  • Store
  • Customer profiles
  • Profile Types

Add a Field

Add a Field

Just like any other Drupal interface, you can add any fields you would like to your customer profiles. For this example, we're just going to use the built-in text field, but you could add the phone field module and have access to phone number validation.

  • Administration
  • Store
  • Customer profiles
  • Profile Types

Checkout Example

Checkout Example

Here on checkout you can see our address field which is a part of the default Commerce Kistart. Additionally, below that you now see the Phone number field we've added. Let's go ahead and checkout to get to the next step.

Read the disclaimer on the customer profile edit screen.

Edit Customer Profile

Here we are editing the customer profile. Normally this might need to be updated to account for a customer who needs to change their shipping address or other kinds of updates. Note that the original customer profile does not get lost, we simply clone a copy of the original and make the changes. We are doing this action to show you how this process works. Note that this means, by default, if you edit a customer profile it does not change the original order.

  • Administration
  • Store
  • Customer profiles
  • Edit Customer Profile

Cloned message.

Cloned message.

This is the message you get after editing the customer profile.

  • Administration
  • Store
  • Customer profiles
  • Cloned message.

Extending the Default Customer Profile

The only profile type the Customer module defines is a billing information profile. This profile has the default address field and nothing more, but it may be extended to include other fields pertinent to payment (like VAT numbers for B2B sales) by modules or the manage fields UI for that type.