Skip to main content

createCustomer

Create a new customer account with email, password, and profile data.

Import

import { createCustomer } from "@evershop/evershop/customer/services";

Syntax

createCustomer(data: CustomerData, context?: Record<string, unknown>): Promise<Customer>

Parameters

data

Type: CustomerData

{
email: string; // Customer email (required)
password: string; // Plain text password (required)
full_name: string; // Customer full name (required)
group_id?: number; // Customer group ID (default: 1)
status?: number; // Account status (default: 1)
}

context (optional)

Type: Record<string, unknown>

Additional context for hooks.

Return Value

Returns Promise<Customer> without password field.

Examples

Basic Customer Creation

import { createCustomer } from "@evershop/evershop/customer/services";

const customer = await createCustomer({
email: 'john@example.com',
password: 'SecurePass123!',
full_name: 'John Doe'
});

console.log(`Customer created with ID: ${customer.customer_id}`);

See Also