Signature
do_action( 'mam_wc_pv_process_vendor_registration', int $user_id, string $role );
| Parameter | Type | Description |
|---|---|---|
$user_id |
int |
Existing WordPress user id to become the vendor’s first admin |
$role |
string |
Role to set on the user, e.g. wc_product_vendors_pending_vendor (manual approval) or wc_product_vendors_manager_vendor |
What the registered handler does
This plugin attaches the canonical handler (priority 10), which runs vendor_registration_form_process():
- Inserts a new
wcpv_product_vendorsterm namedfirstname-lastname-userid(term args filterable via WCPV’s ownwcpv_registration_term_args). - Sets the term’s
vendor_datameta with the user as the only admin. - Copies the user’s billing meta (address, city, state, zip, phone) into the vendor’s term metas and geocodes the address (requires the
tsl-google-api-keyoption for coordinates). - Marks the vendor
typeasparent. - Replaces the user’s role with
$role(viawp_update_user). - Emails the site
admin_emaila “New Seller Account Pending” notice.
When to fire it
Fire it from your own plugin when you need a vendor created for a user you’ve already provisioned — this is the REPO_BOUNDARIES-compliant alternative to instantiating mam_woocommerce_product_vendors_general_functions directly. For example, mam-woocommerce-ride-share registers each approved driver as a vendor:
do_action( 'mam_wc_pv_process_vendor_registration', $user_id, 'wc_product_vendors_manager_vendor' );
Notes
- The handler does not check capabilities — the caller is responsible for deciding the user may become a vendor and for choosing a safe
$role. Do not pass roles taken from request input; validate againstmam_pv_assignable_rolessemantics first. - The role is set, not added: the user’s previous role is replaced.
- The full app sign-up flow (user creation, notifications,
mam_wc_pv_vendor_registration_completed) is the Sign up as Vendor form — this action is only the vendor-creation core. - The action only has a handler when WooCommerce Product Vendors is active; guard with
has_action()/did_action()if your plugin may run without it.
Related articles
- Recipe: Vendor onboarding and registration
- Hook:
mam_pv_assignable_roles
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-woocommerce-product-vendors |
| Applies to plugin version | 26.19.1+ |
| Category | Extending MAM Suite |
| Hook type | action |
| Audience | PHP developer / integrator |
| Last verified | 2026-06-10 |
