Customer Groups overview

Edit on GitHub

Customer Groups let you organize customers into groups to help you target users for discounts and promotions.

Members of a customer group

A customer group can hold the following members:

  • Customers: discount conditions and other rules that target a customer group evaluate the customers of the group.
  • Companies and business units: with the B2B Customer Groups feature, a customer group also records which B2B accounts belong to it. You manage these memberships in the Back Office, through the Backend API, and by data import. If enabled, the customer-group discount condition also evaluates the company users of these companies and business units. Other rules that target a customer group evaluate only its customers. For details, see Customer groups in discount conditions.

To install company and business unit memberships, see Install the B2B Customer Groups feature.

Company and business unit memberships

A company membership and a business unit membership are independent of each other. Each records only the company or business unit that was assigned:

  • Assigning a company does not assign its business units or its company users.
  • Assigning a business unit does not assign its company, its parent or child business units, or its company users.
  • Removing a company from a group keeps the business units of that company in the group.
  • Removing the last business unit of a company keeps the company in the group.

These rules describe the stored memberships. When the customer-group discount condition evaluates them, a business unit membership also applies to the company users of its child business units. For details, see How business unit assignments are inherited.

A company or business unit can belong to any number of customer groups, and a customer group can hold business units of different companies.

Managing memberships never changes the companies, business units, company users, or customers themselves. Deleting a customer group removes its memberships, and deleting a company or business unit removes it from every customer group.

Manage memberships in the Back Office

In the Back Office, the pages that create and edit a customer group have a Companies tab and a Business Units tab next to the Customers tab. Each tab has the following tables:

  • An available table that lists the companies or business units that are not assigned to the group. You select the ones to assign.
  • An assigned table that lists the members of the group. You select the ones to remove.

Companies tab of the Edit customer group page

Business Units tab of the Edit customer group page

The selections are saved together with the customer group. The page that shows a customer group displays the Companies and Business Units panels, with an Edit button that opens the edit page of each company or business unit.

View customer group page with the Companies and Business Units panels

The Customers column of the tables counts company users:

  • For a company, all of its company users, including inactive ones.
  • For a business unit, only the company users directly in that business unit, not the users of its child business units, including inactive ones.

For instructions, see Manage customer groups.

Find the customer groups of a customer, company, or business unit

With the B2B Customer Groups feature, the Customer Groups page in the Back Office has a filter that lists only the groups a specific customer, company, or business unit is assigned to. You select the assignment type, search for the customer, company, or business unit by entering at least three characters, and apply the filter.

The filter returns only direct assignments:

ASSIGNMENT TYPE SEARCH BY GROUPS LISTED
Customer Email address, first name, last name, or customer reference. The groups the customer is assigned to directly. The groups of the customer’s company or business unit are not listed.
Company Company name. The groups the company is assigned to. The groups of its business units are not listed.
Business Unit Business unit name, across all companies. The groups the business unit is assigned to. The groups of its company or parent business units are not listed.

The customer-groups Backend API resource accepts the same filters by customer reference, company UUID, and business unit UUID. For details, see Backend API: Manage customer groups.

Manage memberships using the Backend API

The Backend API lets integrations, such as an ERP, a CRM, or a partner administration tool, list, add, replace, and remove the companies and business units of a customer group. A write through the Backend API changes the same memberships as a save in the Back Office.

For the endpoints, see Backend API: Manage companies and business units of customer groups.

Import customer groups and their memberships

Four data importers load customer groups and their members in bulk, for example, from an ERP export:

FILE WHAT IT DOES
customer_group.csv Creates customer groups and updates their descriptions.
customer_group_to_company.csv Assigns companies to customer groups.
customer_group_to_company_business_unit.csv Assigns business units to customer groups.
customer_group_to_customer.csv Assigns customers to customer groups.

An imported membership is the same membership that a Back Office save creates: it is listed in the Back Office, and you can remove it there. The membership files work as follows:

  • They only add memberships. They never remove a membership, and they never create, change, or delete a customer group, company, business unit, company user, or customer.
  • Each file assigns only what it names: importing a company does not assign its business units or customers.
  • Importing the same file again changes nothing. A membership that already exists, from an earlier import or from the Back Office, is skipped.
  • A row that refers to a customer group, key, or customer reference that does not exist is rejected. The other rows are still imported, the import report lists the reason for each rejected row, and the run is reported as failed.

The membership importers address companies and business units by their keys. Companies and business units created in the Back Office, through the Backend API, or by self-registration have no key, so the import cannot assign them.

As with other data importers, the import report lists only the first 50 rejected rows by default. A row whose number of columns differs from the header stops the import of the rest of that file.

Customer groups in discount conditions

When you create a discount, you can use the customer-group field in the APPLY WHEN condition to apply the discount only to customers of a specific group. For details, see Create discounts.

By default, the condition checks only the groups a customer is assigned to directly. With the B2B Customer Groups feature, a developer can enable the condition to also check the groups of the customer’s company and business units. This lets you offer a discount to all users of a B2B company or business unit without assigning each customer to the group individually. For instructions, see Install the B2B Customer Groups feature.

When enabled, a customer is in a customer group for the condition in the following cases:

  • The customer is assigned to the group directly.
  • The company of the company user the customer currently shops as is assigned to the group.
  • The business unit of the company user the customer currently shops as, or any of its parent business units, is assigned to the group.

The group name in the condition is matched case-insensitively.

The operators of the condition work as follows:

  • Equal, In, and Contains: the condition is met if at least one of the customer’s groups matches the value.
  • Not equal, Not in, and Doesn’t contain: by default, the condition is met if at least one of the customer’s groups does not match the value. A developer can configure these operators to apply to all groups of the customer. Then the condition is met only if none of the customer’s groups matches the value. For instructions, see Install the B2B Customer Groups feature.

For example, a customer belongs to the groups A and B. By default, a discount with customer-group != "A" applies to this customer, because the group B does not match. If the negated operators apply to all groups, the discount does not apply, because the group A matches.

A guest and a logged-in customer who belongs to no group never meet a customer-group condition, with any operator.

Select a customer group in a discount condition

In the query builder of the Conditions tab, the value field of the customer-group rule suggests the names of existing customer groups after you enter two characters. The suggestions match the name or the description of a group. For the Equal, Not equal, In, and Not in operators, you select a suggested group, and for In and Not in, you can select several groups. Free text is accepted only for the Contains and Doesn’t contain operators.

When you save a discount, every customer group that the condition names with the Equal, Not equal, In, or Not in operator must exist. If a group does not exist, for example, because it was renamed or deleted after the discount was created, the save is rejected with the Could not find "{group_name}" for field "customer-group". error. This check also applies to existing discounts, so fix the condition before you save other changes of the discount. The check runs only when a discount is saved, so an existing discount with such a condition stays active in the Storefront:

  • With Equal or In, the condition can no longer be met through the missing group.
  • With Not equal or Not in, no customer belongs to the missing group, so the condition is met for every logged-in customer who belongs to at least one group. For example, a discount with customer-group != "X" applies to every customer with a group after the group X is deleted.

The same check applies when you create or update a discount using the Backend API: an unknown group returns 422 with the error code 5706 and the same message. For details, see Backend API: Manage discounts.

The suggestions and the check on save require CustomerGroupSuggestDecisionRulePlugin. For instructions, see Install the B2B Customer Groups feature.

How business unit assignments are inherited

A business unit assignment covers the business unit and all its child business units at any depth. It never covers the parent or sibling business units. Only the company user that the customer currently shops as is considered. The customer’s other company users do not add any groups.

For example, a company has the following business unit hierarchy, and the business unit Zurich is assigned to the customer group DACH Region:

HQ
├── Zurich
│   └── Zurich Sales
└── Barcelona
CUSTOMER’S CURRENT BUSINESS UNIT BUSINESS UNITS CHECKED MEMBER OF DACH REGION
Zurich Zurich, HQ Yes. Zurich is assigned to the group.
Zurich Sales Zurich Sales, Zurich, HQ Yes. Zurich Sales inherits the assignment of its parent business unit.
HQ HQ No. An assignment of a child business unit does not apply to its parent.
Barcelona Barcelona, HQ No. Barcelona is a sibling of Zurich.

If a customer belongs to the same group in several ways, the group is counted once.

When changes take effect

When you assign or unassign a company or business unit, or move a business unit to another parent, the change applies from the next request — for example, the next cart update. If a cart update removes a discount, the customer sees a message that the discount is no longer available. Discounts of placed orders are not affected.

Current constraints

The feature has the following functional constraints:

  • Company and business unit memberships affect only the customer-group discount condition, and only if it is enabled. They do not affect prices, product lists, content, or any other rule that targets a customer group.
  • In the Back Office tables, you select companies and business units one at a time. There is no option to select all rows.
  • A Backend API request that replaces the members of a customer group accepts up to 1,000 companies or business units. To change a larger set, add and remove members individually.
  • A customer group whose name contains a single quote (') or a double quote (") cannot be used in a discount condition with any operator. A customer group whose name contains a semicolon (;) cannot be used with the In and Not in operators, because they split the value at semicolons. Equal and Not equal compare the whole name, so they work with a semicolon. In these cases, saving the discount fails with Could not find "{part_of_the_name}". To use such a group in a discount, rename it.
BACK OFFICE USER GUIDES
Manage customer groups
INSTALLATION GUIDES GLUE API GUIDES DATA IMPORT
Install the B2B Customer Groups feature Backend API: Manage customer groups File details: customer_group.csv
Backend API: Manage companies and business units of customer groups File details: customer_group_to_company.csv
File details: customer_group_to_company_business_unit.csv
File details: customer_group_to_customer.csv