Writing to metafield and metaobject using the customerAccount api

Can you write to the metafield/metaobject tied to a customer data using the customerAccount api?

1 Like

Hello @ygpatel As of now, you cannot write to metafields or metaobjects tied to customer data using the Shopify Customer Account API. The Customer Account API is designed primarily for customer-facing operations, such as signing in, creating accounts, viewing orders, and interacting with customer data in a limited, secure way.

Here’s a breakdown:

Feature Customer Account API Admin API (or Storefront AP

Read basic customer data

Update metafields X (via Admin API only)

Read/write metaobjects X (Admin API)

Workaround:
If your goal is to let a logged-in customer update or interact with metafield/metaobject data, you have to:

  1. Create a secure proxy app or server function.

  2. Let the Customer Account API authenticate the customer.

  3. Have your app use the Admin API (with proper permissions) to update the customer metafield or metaobject.

Example Flow:

  1. Customer signs in via Hydrogen or custom app (Customer Account API).

  2. Frontend collects the metafield/metaobject input.

  3. Frontend sends data to your app/backend.

  4. Backend (with Admin API access) updates the metafield/metaobject for that customer.

Thank you :blush:

Thank you and much appreciated. I will give it a try.

1 Like