Question

Im getting this error while trying to create a product in magento

"Error occurred during "custom_attributes" processing. Attribute "color" has invalid value. The "black" value's type is invalid. The "int" type was expected. Verify and try again."

This is the payload i am passing

{
  "product": {
    "sku": "Snee1",
    "name": "Snee Tee Large",
    "attribute_set_id": 11,
    "price": 25,
    "status": 1,
    "visibility": 1,
    "type_id": "simple",
    "weight": "0.5",
    
    "extension_attributes": {
        "category_links": [
            {
                "position": 0,
                "category_id": "11"
            },
            {
                "position": 1,
                "category_id": "12"
            },
            {
                "position": 2,
                "category_id": "16"
            }
        ],
        "stock_item": {
            "qty": "10",
            "is_in_stock": true
        }
    },
    "custom_attributes": [
        {
            "attribute_code": "spc",
            "value":"snee1"
        },
        {
            "attribute_code": "description",
            "value": "The Champ Tee keeps you cool and dry while you do your thing. Let everyone know who you are by adding your name on the back for only $10."
        },
        {
            "attribute_code": "tax_class_id",
            "value": "2"
        },
        {
            "attribute_code": "material",
            "value": "148"
        },
        {
            "attribute_code": "pattern",
            "value": "196"
        },
        {
            "attribute_code": "color",
            "value": "black"
        },
        {
            "attribute_code": "size",
            "value": "170"
        }    ]
  }
}

I understand i am creating a product with a custom attribute of color and the value should be an int but i have tried to pass "black".

My question is , is there a way to configure magento to receive the value instead of the int value?

I am asking as we are integrating with an epos provider and they seem to only be able to pass the actual value instead of the id

Thanks

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top