---
title: Synchronizing customer and user properties
related:
  - https://docs.kentico.com/k10/e-commerce-features/managing-your-store/customers.md
  - https://docs.kentico.com/k10/managing-users/user-management.md
  - https://docs.kentico.com/k10/custom-development/customizing-providers.md
  - https://docs.kentico.com/k10/e-commerce-features/customizing-and-developing-your-store/e-commerce-customization-model.md
  - https://docs.kentico.com/k10/custom-development.md
  - https://docs.kentico.com/k10/e-commerce-features/customizing-and-developing-your-store/customer-related-customizing/customizing-creation-of-new-customers.md
  - https://docs.kentico.com/k10/e-commerce-features/customizing-and-developing-your-store/customer-related-customizing/customizing-customers-preferred-currency-payment-method-and-shipping-option.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).

Since customers (part of the **CMS.Ecommerce** namespace) and users (part of the **CMS.Membership** namespace) are different entities inside Kentico, their properties are synchronized.

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

- [From customers' properties to users' properties](#from-customers-properties-to-users-properties)
- [From users' properties to customers' properties](#from-users-properties-to-customers-properties)

## From customers' properties to users' properties

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

### Properties synchronized by default

|            | Column name in the database table                                                       |                             |
| ---------- | --------------------------------------------------------------------------------------- | --------------------------- |
| 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 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 whether any of the customer's synchronized properties were changed
      return updated;
}

```

## From users' properties to customers' properties

If a user's properties are changed, the **CopyDataFromUserTo**Customer\*\*\*\* method is triggered.

### Properties synchronized by default

|            | Column name in the database table |                                 |
| ---------- | --------------------------------- | ------------------------------- |
| 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 whether any of the user's synchronized properties were changed
      return updated;
}

```
