storetown-media / module-b2b-register
B2B customer registration with admin approval workflow for Magento 2 / Adobe Commerce. Adds a dedicated B2B signup form with company data, VAT ID, and reCAPTCHA, holds new accounts in a pending state until a store admin reviews them, and triggers separate transactional emails for the customer and the shop owner.
STM B2B Register - Magento 2 Extension
B2B customer registration with admin approval workflow for Magento 2 / Adobe Commerce.
Features
- B2B Registration Form - Dedicated registration page with company details, contact person, address, and optional fields (VAT ID, customer number, salutation)
- Admin Approval Workflow - New B2B customers are set to "Pending" status and must be approved or rejected by an admin before they can log in
- Customer Grid Integration - B2B Status and Company columns in the customer grid with filter and sort support
- Mass Actions - Bulk approve/reject B2B customers directly from the customer grid
- Email Notifications - Configurable approval, rejection, and admin notification emails
- Google reCAPTCHA v2 - Optional spam protection for the registration form
- Registration Modes - Hybrid (B2B + B2C), B2B Only, or B2C Only with automatic redirects and link banners
- Customizable Form Design - Primary and secondary color picker in admin configuration
- Field Visibility Control - Configure which fields are shown (hidden, optional, or required) per store view
- Fully Translatable - English as primary language with German translation included (
de_DE.csv)
Requirements
- Magento Open Source 2.4.x or Adobe Commerce 2.4.x
- PHP 8.1, 8.2, 8.3 or 8.4
Installation
Via Composer (recommended)
composer require storetown-media/module-b2b-register
bin/magento module:enable STM_B2bRegister
bin/magento setup:upgrade
bin/magento cache:flush
Manual Installation
- Create the directory
app/code/STM/B2bRegister/ - Copy all module files into this directory
- Run:
bin/magento module:enable STM_B2bRegister
bin/magento setup:upgrade
bin/magento cache:flush
Configuration
Navigate to Stores > Configuration > STM > B2B Register in the Magento Admin.
General Settings
| Setting | Description |
|---|---|
| Module Enabled | Enable or disable B2B registration |
| Page Title | Title of the registration page |
| Default Customer Group (Pending) | Customer group assigned before approval |
| Customer Group After Approval | Customer group assigned after approval (empty = manual) |
| Pre-selected Country | Default country in the registration form |
| Registration Mode | Hybrid, B2B Only, or B2C Only |
Form Settings
| Setting | Description |
|---|---|
| Show Tax Number/VAT ID | Hidden, Visible (optional), or Visible (required) |
| Show Customer Number | Hidden, Visible (optional), or Visible (required) |
| Show Salutation | Hidden, Visible (optional), or Visible (required) |
| Show Newsletter Checkbox | Yes/No |
| Terms CMS Page | CMS page for terms link |
Email Settings
| Setting | Description |
|---|---|
| Send Approval Email | Notify customer on approval |
| Send Rejection Email | Notify customer on rejection |
| Email Sender | Store identity used as sender |
| Admin Notification | Notify admin on new registration |
| Admin Email Address | Recipient for admin notifications |
Form Design
| Setting | Description |
|---|---|
| Primary Color | Headings, buttons, borders |
| Secondary Color | Button hover, accents |
Google reCAPTCHA
| Setting | Description |
|---|---|
| Enable reCAPTCHA | Show reCAPTCHA v2 checkbox |
| Site Key | Google reCAPTCHA v2 public key |
| Secret Key | Google reCAPTCHA v2 private key |
Approval Workflow
- Customer fills out the B2B registration form
- Account is created with Pending status
- Admin receives email notification (if enabled)
- Customer cannot log in while status is Pending
- Admin approves or rejects via:
- Customer Edit Page - Approve/Reject buttons
- Customer Grid - Mass actions for bulk operations
- Customer receives approval/rejection email (if enabled)
- On approval, customer group is updated automatically (if configured)
Events
The extension dispatches the following events for third-party integrations:
| Event | When |
|---|---|
stm_b2b_registration_before |
Before customer account creation |
stm_b2b_registration_after |
After successful registration (includes B2B data) |
customer_register_success |
Standard Magento event for compatibility |
stm_b2b_newsletter_subscribe |
When newsletter subscription is selected |
stm_b2b_customer_approved |
When a B2B customer is approved |
stm_b2b_customer_rejected |
When a B2B customer is rejected |
Translation
The extension uses English as the primary language. A German translation is included in i18n/de_DE.csv.
To add additional translations, create the corresponding CSV file in i18n/ (e.g., i18n/fr_FR.csv).
Running Tests
cd /path/to/magento
vendor/bin/phpunit -c app/code/STM/B2bRegister/phpunit.xml.dist
Code Quality
vendor/bin/phpcs --standard=Magento2 app/code/STM/B2bRegister/
The extension passes PHPCS Magento2 standard with 0 errors and 0 warnings (using the included phpcs.xml).
File Structure
STM/B2bRegister/
├── Api/ # Service contracts
├── Block/ # Frontend and admin blocks
├── Controller/ # Frontend and admin controllers
├── Model/ # Business logic, config, email
├── Plugin/ # Login blocking, redirect, welcome email
├── Setup/Patch/Data/ # Data patches for customer attributes
├── Test/Unit/ # PHPUnit test suite (97 tests)
├── Ui/Component/ # Admin grid columns and form modifier
├── etc/ # Module config, DI, routes, system.xml
├── i18n/ # Translation files
├── view/frontend/ # Frontend templates, layouts, emails
├── view/adminhtml/ # Admin templates, UI components
├── composer.json
├── phpcs.xml
├── phpunit.xml.dist
└── registration.php
Support
For issues and feature requests, please contact Storetown Media.
License
Proprietary - All rights reserved.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
[1.0.0] - 2026-04-24
Initial public release on the Adobe Commerce Marketplace.
Added
- Dedicated B2B registration page (
/b2bregister/account/create) capturing
company name, VAT ID / tax number, customer number, salutation, contact
person, delivery address and phone number. - Admin approval workflow: new accounts are placed in a configurable pending
customer group and blocked from login until an admin approves or rejects
them via the customer edit page or the customer grid mass actions. - Customer grid integration with filterable and sortable B2B Status and
Company columns, and the B2B Approve / B2B Reject mass actions. - Four transactional email templates (registration confirmation, admin
notification, approval, rejection), all editable under
Marketing > Email Templates. - Six configuration groups under Stores > Configuration > STM > B2B Register,
scope-aware down to the store view: General, Form, Form Design, Email,
Notice Texts and Google reCAPTCHA v2. - Three registration modes: Hybrid (B2B + B2C with cross-links),
B2B Only (standard registration redirected to B2B) and B2C Only
(module installed but hybrid banner suppressed). - Field visibility control (hidden / optional / required) for VAT ID,
customer number and salutation, per store view. STM\B2bRegister\Api\B2bRegistrationInterfaceservice contract with
approve(),reject()andgetStatus()methods.- Dispatched events for CRM and marketing-automation integrations:
stm_b2b_registration_before,stm_b2b_registration_after,
stm_b2b_customer_approved,stm_b2b_customer_rejected,
stm_b2b_newsletter_subscribe. The standard Magento
customer_register_successevent is dispatched for compatibility. - English source language with German translation (
i18n/de_DE.csv). - Hyvä Theme and Luma-based theme compatibility (no JavaScript framework
dependency on the frontend).
Compatibility
- Magento Open Source 2.4.x and Adobe Commerce 2.4.x
- PHP 8.1, 8.2, 8.3 and 8.4
Requires 11
| Package | Constraint |
|---|---|
| magento/framework | ^103.0 |
| magento/module-backend | ^102.0 |
| magento/module-cms | ^104.0 |
| magento/module-config | ^101.0 |
| magento/module-customer | ^103.0 |
| magento/module-directory | ^100.4 |
| magento/module-email | ^101.1 |
| magento/module-newsletter | ^100.4 |
| magento/module-store | ^101.1 |
| magento/module-ui | ^101.2 |
| php | ~8.1.0||~8.2.0||~8.3.0||~8.4.0 |
Compatibility
Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.
Code Quality
Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge. A phpcs finding can't make a module incompatible.
Static analysis
Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.
PHPStan
Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases.
Tests
Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.
Unit tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Integration tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Security
Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.
More from Storetown Media
View vendorMagento 2 surcharge module with category- and product-level rules, named reusable rules with per-product binding and bulk-assign from the catalog grid, tier and customer-group pricing, conditional caps (min/max/free-threshold) and country-based shipping restriction.
Adds file attachments (PDF, Office, images, videos, YouTube) to products with frontend download and inline preview (PDF, images, txt/csv, Word, Excel, PowerPoint), mass assign, CSV import, auto-assign rules and category grouping for Adobe Commerce / Magento Open Source.
One Page Checkout for Magento 2 — All checkout steps on a single page with AJAX validation, real-time shipping calculation, and responsive design. Compatible with Luma, Blank, and Hyvä themes.
Turn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.