Customer Management
createCustomer
Creates a new customer account.data(CustomerData): Customer data objectemail(string, required): Customer email addresspassword(string, required): Customer passwordfull_name(string, required): Customer full namegroup_id(number, optional): Customer group ID (defaults to 1)status(number, optional): Account status (0=disabled, 1=enabled, defaults to 1)
context(object): Context object for hooks
- Validates required fields and password strength
- Checks for duplicate email addresses
- Hashes password before storage
- Emits
customer_registeredevent if status is 1 - Throws error if email already exists or validation fails
updateCustomer
Updates an existing customer account.uuid(string): Customer UUIDdata(CustomerData): Customer data to updateemail(string): New email addressfull_name(string): Updated full namegroup_id(number): Customer group IDstatus(number): Account status
context(object): Context object for hooks
deleteCustomer
Deletes a customer account.uuid(string): Customer UUIDcontext(object): Context object for hooks
updatePassword
Updates a customer’s password.uuid(string): Customer UUIDcurrentPassword(string): Current password for verificationnewPassword(string): New password
- Verifies current password is correct
- Validates new password strength
- Hashes new password before storage
Address Management
createCustomerAddress
Creates a new address for a customer.customerUUID(string): Customer UUIDaddress(Address): Address data objectfull_name(string): Recipient nametelephone(string): Phone numberaddress_1(string): Address line 1address_2(string, optional): Address line 2city(string): Cityprovince(string): State/Province codepostcode(string): Postal/ZIP codecountry(string): Country code (ISO 2-letter)is_default(boolean): Set as default address
context(object): Context object for hooks
- Validates address data using validation rules
- Verifies customer exists
- If
is_defaultis true, unsets other default addresses - Throws error if customer not found or validation fails
updateCustomerAddress
Updates an existing customer address.uuid(string): Address UUIDaddress(Address): Address data to updatecontext(object): Context object for hooks
deleteCustomerAddress
Deletes a customer address.uuid(string): Address UUIDcontext(object): Context object for hooks
validateAddress
Validates an address object against validation rules.address(object): Address data to validate
valid(boolean): Validation statuserrors(array): Array of validation error messages
- Required fields are present
- Field formats are correct
- Country and province codes are valid
- Postal code format matches country requirements
addAddressValidationRule
Adds a custom validation rule for addresses.name(string): Rule namevalidator(function): Validation function that returns error message or null
Authentication Services
sendResetPasswordEmail
Sends a password reset email to a customer.email(string): Customer email address
- Verifies customer exists with provided email
- Generates secure reset token
- Stores token with expiration time
- Sends email with reset link
- Throws error if customer not found or email fails
Query Builder Services
getCustomersBaseQuery
Returns the base query builder for customers.- Customer group
- Customer addresses
- Order history