Question

My magento installation has 3 stores (domain+language). I would like to update custom attributes for products. When I call

GET products/my_test_sku?storeId=1

i get something like the following json:

{
    "id": 1036,
    "sku": "my_test_sku",
    :
    "custom_attributes": [
        {
            "attribute_code": "question_color",
            "value": "#fa45a4"
        },
        :
    ]
}

I can not figure out how to update values for these custom attributes using some POST or PUT api call. The values are different for each storeId.

I really appreciate any help :-) Kind regards - Mikkel

Was it helpful?

Solution

To answer my own question. For a multi store magento 2 setup you can update of a custom attribute for a given product like this:

PUT {{base_uri}}/rest/{{store_code}}/V1/products/{{sku}}
{
  "Product": {
    "Custom_attributes": [
      {
         "Attribute_code": "some code",
         "Value": "some value"
      }
    ]
  }
}

Thanks Jigar

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