Hey everyone,
Hoping someone might have run into this before. I’m using the REST API to add/update products, and I’m hitting a wall specifically with numeric features (like Type O - Others: Number, or maybe Type N).
Here’s what’s happening:
- I can’t include
product_featureswhen creating a product (POST /products) because it throws a 500 Error (TypeError: mysqli::real_escape_string()). So, I’m doing a two-step: first create the product with basic info, then update it with features usingPUT /products/:id. - The
PUTrequest works perfectly fine for Selectable (S/E/M) and Text/Date (T/D) features. I send these as simple strings ("FEATURE_ID": "VARIANT_ID"or"FEATURE_ID": "VALUE"), and they save correctly. The API gives a200 OK. - However, Numeric (O/N) features just won’t save. I’ve tried sending the value in various ways (
"FEATURE_ID": "3000","FEATURE_ID": {"value": "3000"},"FEATURE_ID": {"value_int": "3000"},{"feature_type": "O", "value": "3000"}, etc.), and while the API always returns200 OK, the numeric value itself is never actually saved to the product (checked viaGET /products/:id?extend=features).
My Questions:
- Does anyone know the correct JSON format to send numeric features (specifically Type O) within
product_featureswhen using thePUT /products/:idAPI? The official docs only show an example for Type T ({"feature_type": "T", "value": "..."}) and no examples for numeric or selectable types in this context. - Could this just be a bug in the
update_productAPI for numeric features?
Right now, my only option is to skip updating numeric features via the API, which isn’t ideal.
Has anyone else encountered this or found a working format for updating numeric features via PUT /products/:id? Any help or pointers would be awesome!
Thanks!