Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Update Select Box Values For Custom Fields Use Rest Api Rate Topic   - - - - -


Posted 28 January 2017 - 03:43 AM #1

I'm trying to integrate a legacy system with CS-Cart and I'd like to use the REST API to create new user accounts for a closed marketplace. I've been able to use Postman to create a new user in CS-Cart and set the value of the predefined user profile fields (company, email, phone, etc), but I'm having trouble updating the custom fields I've added via Administration → Profile fields.  Here's what I'm trying to do:


Custom Fields

consumer_type: [Select Box] (Values: Consumer, Charity, Non Profit, Social Enterprise, Liquidator)

supplier_type: [Select Box] (Values: Farmer, Processor, Retailer, Wholesaler, Distributor)


I'm trying to figure out how to set these values using the User API. Here's what I've tried:


    "consumer_type": "Consumer",
    "supplier_type": "Farmer"
I get a success response, but the field values don't get updated when I view via the admin panel. I've also tried using the field IDs:
consumer_type: field_id=36:
supplier_type: field_id=37:
    "fields": {
        "36": "Consumer",
        "37": "Farmer"
Same thing - I get a success response, but the field values don't get updated. Can someone please explain how to set the value of a custom field Select Box?





Posted 28 January 2017 - 09:46 PM #2

OK, I think I've figured this out. When creating a new Profile field that uses a Select Box you need to enter the selections via the "Variants" tab. Each variant is assigned a sequential ID. In my example, here is how the IDs were assigned:


Custom Fields (id: value)

consumer_type = {

"1": "Consumer",

"2": "Charity",

"3": "Non Profit",

"4": "Social Enterprise",

"5": "Liquidator"


supplier_type = {

"6": "Farmer",

"7": "Processor",

"8": "Retailer",

"9": "Wholesaler",

"10": "Distributor"



Now that I know how the IDs are assigned it's easy to reference them, however my integration will break if the CS-Cart admin changes anything in the profile forms. For example, if an admin accidentally deletes a variant value and then adds it back with exactly the same value it'll still be assigned a new ID, thereby breaking my integration.


Is there a way to use the API to query for the field values and IDs so that I can make my code robust to changes by the CS-Cart admin?




  • tobill
  • Newbie
  • Members
  • Join Date: 07-Jul 20
  • 1 posts

Posted 21 July 2020 - 05:47 PM #3

Can you provide more detail here? I'm trying to accomplish the same thing via the Vendors API and 2 custom fields. I'm getting a 200 response but the fields aren't being added/updated in the database.


PUT https://{{URL}}/api/vendors/20


"vendor_id": "2",
"store_id": "385"

Response: 200

"store_id": "20"