4

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)

1
  • Did you find any solution for this? Commented Mar 9, 2021 at 20:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.