1

I am using product repository save() (rest POST /V1/products) to create/update products.

With a single select attribute I can add an option, but can't see any way to clear the attribute option if it's already set. Have tried sending 'null' and '' - doesn't add a new attribute, but also doesn't remove any existing ones either.

Here's a sample of the custom_options object within the product object.

 "custom_attributes": [
    {
      "attribute_code": "color",
      "value": "98"
    }

If I do something like this, the value remains in the database.

  "custom_attributes": [
    {
      "attribute_code": "color",
      "value": null
    }
0

It appears that null works - I had some custom code which was returning a false value.

Confirmed that data is being removed from catalog_product_eav_int/varchar for single/multi select attributes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.