如何通过BigCommerce API更新账户注册客户自定义字段?
Hey Deepak, I’ve dealt with this exact frustration before—BigCommerce’s customer custom field update logic is a bit different from product custom fields, so the solution you found for products doesn’t translate directly. Let me break down what you need to do:
The Key Issue
When you pull customer data, the form_fields array includes the field name, but you can’t use the name property to update the field via PUT. Instead, you need to reference the custom field’s unique id value, which is also included in the GET response (you might have missed it!).
Step-by-Step Fix
First, get the customer’s full data to retrieve the field ID
Call the GET/v3/customers/{customer_id}endpoint. Look for theform_fieldsarray in the response—each object will have anid,name, andvalueproperty. For your "Rep Id" field, grab thatidnumber.Construct your PUT request with the field ID
Replace thenameproperty in yourform_fieldsobject with theidyou just retrieved. Here’s what the corrected request body looks like:{ "first_name": "Deepak", "last_name": "Bandi", "email": "bandideepakreddy@gmail.com", "company": "", "phone":"3123152269", "store_credit":"", "notes":"", "tax_exempt_category":"", "customer_group_id": 0, "form_fields": [ { "id": 12345, // Replace with your actual "Rep Id" field ID "value": "10025" } ] }
Important Notes
- Double-check that your API token has the
customers_modifypermission—without this, you’ll get a 403 error even with the correct payload. - If you’re updating multiple custom fields, include each one as an object in the
form_fieldsarray, each with its ownidandvalue. - Unlike product custom fields, you don’t need to include all custom fields in the PUT request—only the ones you want to update.
内容的提问来源于stack exchange,提问作者Deepak Bandi

