2

I have a dropdown custom attribute with values:

"options": [
    {
        "label": " ",
        "value": ""
    },
    {
        "label": "Green",
        "value": "5640"
    },
    {
        "label": "Blue",
        "value": "5641"
    },
    {
        "label": "Red",
        "value": "5642"
    }
]

When updating products in Magento 2.2, if I want to set the value to the default (no value chosen), I would use the following in my JSON request body.

"custom_attributes": [
        {
            "attribute_code": "new_color",
            "value": ""
        }
    ]

In Magento 2.3, it is not working anymore and the error is

"message": "Error occurred during \"custom_attributes\" processing. Attribute \"new_color\" has invalid value. The \"\" value's type is invalid. The \"int\" type was expected. Verify and try again.",
"trace": null 

How will I be able to set to the default value if the default value of the custom attribute is "" and not an int type?

Note that in the admin, I can do it by just selecting the default value, but I want to know how it can be done thru the API

enter image description here

2

0

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.