2

I am trying to update a product via the Magento 2 Rest API.

If an attribute already has a value I can update that value with another value with no problems.

However if I want to delete the value and leave the attribute blank it will not update and just leaves the old value in place.

I have tried submitting NULL and blank values but with no effect.

array( 'attribute_code' => 'standard_consumables', 'value' => '' ),
array( 'attribute_code' => 'standard_consumables', 'value' => NULL ),

How can I remove a custom attribute value via the REST API.

Thanks

3
  • do you found answer for this? Commented Sep 11, 2017 at 15:14
  • Unfortunately not
    – LeoMan
    Commented Sep 11, 2017 at 21:03
  • Niether did I :( I've been finding too many Magento REST API questions unanswered :/ Commented Jul 18, 2018 at 9:25

2 Answers 2

0

This was fixed in 2.2.x, see:

0
"product": {
    "custom_attributes": [
        {
            "attribute_code": "your_attribute_code",
            "value": null
        }
    ]
}

}

This is the correct payload for updating the custom_attribute k

Your Answer

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

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