---
title: Synchronizing customer and user properties
related:
  - https://docs.kentico.com/13/e-commerce-features/managing-on-line-stores/customers.md
  - https://docs.kentico.com/13/managing-users/user-management.md
  - https://docs.kentico.com/13/custom-development/customizing-providers.md
  - https://docs.kentico.com/13/e-commerce-features/customizing-on-line-stores/e-commerce-customization-model.md
  - https://docs.kentico.com/13/custom-development.md
  - https://docs.kentico.com/13/e-commerce-features/customizing-on-line-stores/customer-related-customizing/customizing-creation-of-new-customers.md
  - https://docs.kentico.com/13/e-commerce-features/customizing-on-line-stores/customer-related-customizing/customizing-customer-preferences.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Customers (part of the **CMS.Ecommerce** namespace) and users (part of the **CMS.Membership** namespace) are different entities within Xperience. To avoid unnecessary configuration, the system contains mechanisms for synchronizing the properties of users and customers.

The synchronization uses methods in the **CustomerInfoProvider** class in the **CMS.Ecommerce** namespace and runs in both directions:

- [From customer properties to user properties](#from-customer-properties-to-user-properties)
- [From user properties to customer properties](#from-user-properties-to-customer-properties)

## From customer properties to user properties

If a customer's properties are changed, the **CopyDataFromCustomerToUser** method is triggered.

### Properties synchronized by default

|            | Column name in the database                                                             |                             |
| ---------- | --------------------------------------------------------------------------------------- | --------------------------- |
| From       | To                                                                                      |                             |
| First name | COM\_Customer.CustomerFirstName                                                         | CMS\_User.FirstName         |
| Last name  | COM\_Customer.CustomerLastName                                                          | CMS\_User.LastName          |
| Full name  | COM\_Customer.CustomerFirstName + CMS\_User.MiddleName + COM\_Customer.CustomerLastName | CMS\_User.FullName          |
| Email      | COM\_Customer.CustomerEmail                                                             | CMS\_User.Email             |
| Phone      | COM\_Customer.CustomerPhone                                                             | CMS\_UserSettings.UserPhone |

### Overriding the default synchronization

To change the default synchronization, override the **CopyDataFromCustomerToUserInternal(CustomerInfo customer, UserInfo user)** method.

```csharp

protected virtual bool CopyDataFromCustomerToUserInternal(CustomerInfo customer, UserInfo user)
{
      bool updated = false;

      // Checks that both customer and user are not null
      if ((customer == null) || (user == null))
      {
            return false;
      }

      // Checks whether the customer's first name was updated
      if (!string.Equals(customer.CustomerFirstName, user.FirstName))
      {
            user.FirstName = customer.CustomerFirstName;
            updated = true;
      }

      // Checks whether the customer's email was updated
      if (!string.Equals(customer.CustomerEmail, user.Email))
      {
            user.Email = customer.CustomerEmail;
            updated = true;
      }

      // Checks whether the customer's last name was updated
      if (!string.Equals(customer.CustomerLastName, user.LastName))
      {
            user.LastName = customer.CustomerLastName;
            updated = true;
      }

      // Checks whether the customer's phone number was updated
      if (!string.Equals(customer.CustomerPhone, ValidationHelper.GetString(user.UserSettings.GetValue("UserPhone"), "")))
      {
            user.UserSettings.SetValue("UserPhone", customer.CustomerPhone);
            updated = true;
      }

      // Sets the full name from the first, middle and last names
      user.FullName = UserInfoProvider.GetFullName(customer.CustomerFirstName, user.MiddleName, customer.CustomerLastName);

      // Returns a bool value that indicates whether any of the customer's synchronized properties were changed
      return updated;
}

```

## From user properties to customer properties

If a user's properties are changed, the **CopyDataFromUserToCustomer** method is triggered.

### Properties synchronized by default

|            | Column name in the database |                                 |
| ---------- | --------------------------- | ------------------------------- |
| From       | To                          |                                 |
| First name | CMS\_User.FirstName         | COM\_Customer.CustomerFirstName |
| Last name  | CMS\_User.LastName          | COM\_Customer.CustomerLastName  |
| Email      | CMS\_User.Email             | COM\_Customer.CustomerEmail     |
| Phone      | CMS\_UserSettings.UserPhone | COM\_Customer.CustomerPhone     |

### Overriding the default synchronization

To change the default synchronization, override the **CopyDataFromUserToCustomerInternal(CustomerInfo customer, UserInfo user)** method.

```csharp

protected virtual bool CopyDataFromUserToCustomerInternal(CustomerInfo customer, UserInfo user)
{
      bool updated = false;

      // Checks that both customer and user are not null
      if ((customer == null) || (user == null))
      {
            return false;
      }

      // Checks whether the user's first name was updated
      if (!string.Equals(customer.CustomerFirstName, user.FirstName))
      {
            customer.CustomerFirstName = user.FirstName;
            updated = true;
      }

      // Checks whether the user's email was updated
      if (!string.Equals(customer.CustomerEmail, user.Email))
      {
            customer.CustomerEmail = user.Email;
            updated = true;
      }

      // Checks whether the user's last name was updated
      if (!string.Equals(customer.CustomerLastName, user.LastName))
      {
            customer.CustomerLastName = user.LastName;
            updated = true;
      }

      // Checks whether the user's phone was updated
      if (!string.Equals(customer.CustomerPhone, ValidationHelper.GetString(user.UserSettings.GetValue("UserPhone"), "")))
      {
            customer.CustomerPhone = ValidationHelper.GetString(user.UserSettings["UserPhone"],"");
            updated = true;
      }

      // Returns a bool value that indicates whether any of the user's synchronized properties were changed
      return updated;
}

```
