Extending customer information


It's fairly common to need to store additional customer information on the default customer profile. Let's say, for example, your client has mostly organizational customers – and you need to be able to differentiate between org. and private customers – so you'd like to add a Company Name field to the Customer profile. Here are the steps:

  1. In the core database, update the Customer template /templates/ecommerce/security/profiles/Customer to add your new fields
  2. Access these additional fields through the CustomProperties field on CustomerInfo. e.g. customerInfo.CustomProperties["JoinDate"] = DateTime.Now();
  3. (optional) You can extend ActiveCommerce.Users.CustomerInfo (v3.3) or Sitecore.Ecommerce.Users.CustomerInfo (v3.2 or prior) to add properties which expose the values from CustomProperties. If you do this in v3.2 or prior, be sure to populate BillingAddress and ShippingAddress properties when configuring in the container. Should be something like this:
    //v3.2 or prior
    container.RegisterType<Sitecore.Ecommerce.DomainModel.Users.CustomerInfo, My.CustomerInfo>(new InjectionMember[]
        new InjectionProperty("BillingAddress"),
        new InjectionProperty("ShippingAddress")

    container.RegisterType<Sitecore.Ecommerce.DomainModel.Users.CustomerInfo, My.CustomerInfo>();

In 3.3 

You can find example code for extending customer information on our examples GitHub:

Custom Customer Profile Data Example

Have more questions? Submit a request