PHPackages                             select-co/module-assign-new-customer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. select-co/module-assign-new-customer

ActiveMagento2-module

select-co/module-assign-new-customer
====================================

N/A

1.0.0(8mo ago)0101ProprietaryPHP

Since Aug 22Pushed 6mo agoCompare

[ Source](https://github.com/SelectCo/magento2-module-assign-new-customer)[ Packagist](https://packagist.org/packages/select-co/module-assign-new-customer)[ RSS](/packages/select-co-module-assign-new-customer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

SelectCo Assign New Customer
============================

[](#selectco-assign-new-customer)

Automatically assigns new customers to a specific customer group based on simple rules that match their email domain and billing country at the moment their account is activated.

This module adds a small configuration UI in Magento Admin where you can define multiple rules. When a new account is activated (either via email confirmation or programmatically), the module evaluates the rules and, on match, updates the customer's group.

Features
--------

[](#features)

- Define multiple assignment rules in Admin
- Rule conditions: Email domain AND Country
- Assign to any existing Magento customer group
- Runs on customer activation (afterActivate / afterActivateById plugin)

Requirements
------------

[](#requirements)

- Magento 2 (tested with 2.3.5)
- PHP compatible with your Magento version
- Dependencies:
    - select-co/module-core ^1.0

Installation
------------

[](#installation)

You can install this module either via Composer or by placing it in app/code.

### Composer (preferred)

[](#composer-preferred)

1. Require the package:
    - `composer require select-co/module-assign-new-customer`
2. Enable and set up the module:
    - `bin/magento module:enable SelectCo_AssignNewCustomer`
    - `bin/magento setup:upgrade`
    - In production mode: `bin/magento setup:di:compile` and `bin/magento setup:static-content:deploy -f`

### Manual installation (app/code)

[](#manual-installation-appcode)

1. Copy this directory to `app/code/SelectCo/AssignNewCustomer`.
2. Run:
    - `bin/magento module:enable SelectCo_AssignNewCustomer`
    - `bin/magento setup:upgrade`
    - In production mode: `bin/magento setup:di:compile` and `bin/magento setup:static-content:deploy -f`

Configuration
-------------

[](#configuration)

- Navigate to: Stores &gt; Configuration &gt; SelectCo Settings &gt; Assign Customer Group Config
- Settings:
    - Enabled: Yes/No
    - Customer Group Rules: Grid where each row defines a rule consisting of:
        - Email Domain: e.g., `example.com` (no leading @)
        - Country: Select a country code to match against the customer's default billing address country
        - Customer Groups: The target group to assign when the rule matches

Rule logic:

- On account activation, the module extracts the domain from the customer's email (text after the `@`).
- It loads the customer's default billing address to read the country.
- For each configured rule, if BOTH the email domain and the country match, the customer's group is updated to the rule's selected group.

Notes:

- Matching is exact and case-sensitive as configured; enter domains in the correct form (e.g., `example.co.uk`).
- The country used for matching is taken from the customer's default billing address. Ensure a default billing address exists by the time the account is activated for rules to work as expected.

How it works (internals)
------------------------

[](#how-it-works-internals)

- A plugin on `Magento\Customer\Api\AccountManagementInterface` runs after `activate` and `activateById`.
- Config path used for rules: `selectco_anc/general/groups` (stored JSON from the system config grid).
- On match, the plugin sets `CustomerInterface::setGroupId()` and saves the customer via `CustomerRepositoryInterface`.

Troubleshooting
---------------

[](#troubleshooting)

- No group change after activation:
    - Confirm the module is Enabled and rules are saved
    - Verify the email domain typed in the rule exactly matches the customer email domain
    - Ensure the customer has a default billing address with the expected country before activation
    - Check Magento logs for any LocalizedException/MailException errors
- Multiple rules match: The module iterates rules in order returned by config; first matching rule that sets a group will take effect. Avoid overlapping rules.

License
-------

[](#license)

MIT. See LICENSE.

Support
-------

[](#support)

If you have a feature request or spotted a bug or a technical problem, create a GitHub issue.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance63

Regular maintenance activity

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

263d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb8edf7bc18e5fb40dfff088ad0b26b0dbb4828d29ebee10131b9be858d4e5fb?d=identicon)[adrianb11](/maintainers/adrianb11)

---

Top Contributors

[![adrianb11](https://avatars.githubusercontent.com/u/77499644?v=4)](https://github.com/adrianb11 "adrianb11 (6 commits)")

### Embed Badge

![Health badge](/badges/select-co-module-assign-new-customer/health.svg)

```
[![Health](https://phpackages.com/badges/select-co-module-assign-new-customer/health.svg)](https://phpackages.com/packages/select-co-module-assign-new-customer)
```

###  Alternatives

[fastly/magento2

Fastly CDN Module for Magento 2.4.x

1564.2M1](/packages/fastly-magento2)[mage-os/module-automatic-translation

Automatic AI content translation for Mage-OS.

277.1k](/packages/mage-os-module-automatic-translation)[zepgram/module-rest

Technical module to industrialize API REST call with dependency injection pattern using Guzzle library

1326.2k](/packages/zepgram-module-rest)[graycore/magento2-graphql-introspection-cache

1015.2k](/packages/graycore-magento2-graphql-introspection-cache)[mage-os/mageos-common-async-events

Send REST requests to external endpoints asynchronously. This module implements the most common events like order creation and customer change.

147.7k2](/packages/mage-os-mageos-common-async-events)[mage-os/module-inventory-reservations-grid

Add a grid with the list of inventory reservations.

126.8k](/packages/mage-os-module-inventory-reservations-grid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
