register
Registers a new customer in the customer list assigned to the SFCC site.
This method communicates with the register endpoint of the Vue Storefront API Middleware. In turn, it posts data to the registerCustomer or the Register customer endpoints exposed by SCAPI / OCAPI, depending on the middleware configuration.
The mandatory data are the credentials, profile last name, and email.
Signature
export declare function register(
props: CustomerRegisterParams
): Promise<import("commerce-sdk/dist/customer/customer").ShopperCustomers.Customer>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | CustomerRegisterParams | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
Returns a representation of the registered Customer.
Referenced Types
CustomerRegisterParamsShopperCustomers.Customer
Examples
Register a customer with basic details.
import { sdk } from '~/sdk.config.ts';
const products = await sdk.commerce.register({
password: 'somePasswordValue',
customer: {
email: 'email@provider.com',
login: 'email@provider.com',
firstName: 'FirstName',
lastName: 'Lastname',
},
});