Syntax
Description
TheupdateProfile method updates customer profile information in both Shopify and Lantern. This is an asynchronous operation that validates and saves the provided customer data.
Parameters
fields (Object)
An object containing the customer fields to update. All fields are optional.
options (Object)
An object containing additional options for the update operation. All fields are optional.
Return Value
Type:Promise<Object>
The method returns a Promise that resolves to an object with the following structure:
Error Object Structure
Theerrors object uses field names as keys and error messages as values:
Examples
Basic Usage
Complete Profile Update with Refetching
Form Integration
Error Handling
The method can fail in two ways:-
Validation Errors: When field values don’t meet requirements (e.g., invalid phone format)
- The Promise resolves with
success: falseand anerrorsobject - The errors object maps field names to their respective error messages
- The Promise resolves with
-
Network/System Errors: When the request cannot be completed
- The Promise is rejected with an error object
- Handle these with try/catch blocks