Profile

The Profile page allows authenticated buyers to view and update their account profile information. The page reads from and updates the underlying Salesforce User record, including fields such as:

  • First name
  • Last name
  • Phone number
  • Primary address information

The buyer’s email address is displayed as a read-only field and cannot be modified through the storefront profile experience.

This flow demonstrates how a headless storefront can render buyer profile experiences, including account information and profile management workflows.

Profile Buyer Journey

OperationHTTP MethodEndpoint
Get profileGET/services/data/v68.0/sobjects/User/{userId}
Update profilePATCH/services/data/v68.0/sobjects/User/{userId}

Load the Buyer Profile

  1. Call the following endpoint when the profile page loads:

    GET /services/data/v68.0/sobjects/User/{userId}?fields=FirstName,LastName,Email,Phone,Street,City,State,PostalCode,Country

  2. Use the response to populate the buyer profile form.

  3. Handle missing fields gracefully. Some fields can be omitted from the response because of field-level security (FLS). Default missing values to empty strings or null values instead of treating them as application errors.

  4. Use the retrieved profile data to render:

    • First name
    • Last name
    • Email address
    • Phone number
    • Address information

Save Profile Changes

  1. Update the editable profile fields.

  2. Submit the profile update request by calling:

    PATCH /services/data/v68.0/sobjects/User/{userId}

  3. Include only modified fields in the request body.

  4. After the update succeeds, merge the submitted field values with the response payload. Some fields can be omitted from the response because of field-level security (FLS). Merging the submitted values prevents masked or restricted fields from disappearing from the profile form after the update.

  5. Refresh the profile state using the merged field values.

  6. Display a confirmation message indicating that the profile was updated successfully.

Choose a Profile API Approach

The storefront can retrieve and update buyer profile information using either SObject REST APIs or Commerce Connect APIs.

  • Use SObject REST APIs when the storefront requires access to a broader set of User fields.
  • Use Connect REST APIs with GET /commerce/webstores/{webstoreId}/myprofile when the available Commerce profile fields satisfy your storefront requirements.
  • To add support for additional buyer profile attributes, integrate with the Salesforce Contact record instead of the User record. This pattern is commonly used for B2C storefront implementations where customer profile data is primarily managed on the Contact object.