3

I can add or change a custom attribute of a product, i.e. via

curl -X PUT --header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer MYTOKEN" -d '{"product":{
  "id":1,
  "attribute_set_id":10,
  "name": "Testproduct",
  "sku": "test",
  "custom_attributes": [
      {
         "attribute_code": "test_attribute",
         "value": "the value"
      }
  ]
}, 
"saveOptions":true}' "https://magentohost/rest/default/V1/products/test"

but how can I remove that attribute(-value) again?

Using the admin-backend, I can remove it by setting its value to an empty string, however trying that with the rest api does not change anything. (just as if I leave out the attribute) I also tried it with '"value": null', but then I get an error "Error occurred during \"custom_attributes\" processing. Value is not set for attribute code \"test_attribute\""

I am using Magento 2.1.3 (EE)

Your Answer

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

Browse other questions tagged or ask your own question.