Skip to main content

Syntax

Description

The updateProfile 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

The errors 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:
  1. Validation Errors: When field values don’t meet requirements (e.g., invalid phone format)
    • The Promise resolves with success: false and an errors object
    • The errors object maps field names to their respective error messages
  2. Network/System Errors: When the request cannot be completed
    • The Promise is rejected with an error object
    • Handle these with try/catch blocks