Hopefully somebody can shed some light on this issue.
I have a REST handler that will bulk-update products per store view. Like text translations etc.
Since the provided attributes could be anything, ranging from core attributes and custom attributes I use the main endpoint “products” and provide the product info within the request.
Example:
POST: /store_view_code/V1/products/
{
"product": {
"sku": "testSku",
"custom_attributes": [
{
"attribute_code": "text_attribute like description or something else",
"value": "the translated value"
}
]
}
}
Even though this will update that particular attribute just fine, it will also set several other attributes to overwrite the default value.
See example return below.
All attributes seen in the response below are not set to default anymore.
Note that many other attributes, also store-view attributes among them like “page_layout”, are still set to default…
I have no explanation as to why some attributes are switched to not use the default anymore and some others are not.
Hope someone can help me with this as I am totally lost after hours of testing.
{
"id":123, // global
"sku":"testSku", // global
"name":"The Product title", // Not set to default anymore.
"attribute_set_id":4, // global
"price":123, // Not set to default anymore.
"status":0, // Not set to default anymore.
"visibility":4, // Not set to default anymore.
"type_id":"simple", // global
"created_at":"2024-12-17 18:35:19",
"updated_at":"2024-12-18 22:29:10",
"extension_attributes":{
"website_ids":[
// Hopefully not overwritten, did not test this yet.
],
"stock_item":{
// Full stock item, not store view related.
}
},
"options":[
],
"media_gallery_entries":[
// Hopefully not overwritten, did not test this yet.
],
"custom_attributes":[
// All attributes below not set to default anymore.
// Note that many other attributes, also store-view attributes among them like "page_layout", are still set to default...
{
"attribute_code":"url_key",
"value":"the-product-url-key" // Not set to default anymore.
},
{
"attribute_code":"options_container",
"value":"container2" // Not set to default anymore.
},
{
"attribute_code":"tax_class_id",
"value":"2" // Not set to default anymore. (website scope)
},
{
"attribute_code":"required_options",
"value":"0" // No idea.
},
{
"attribute_code":"has_options",
"value":"0" // No idea.
},
{
"attribute_code":"category_ids",
"value":[
// Hopefully not overwritten, did not test this yet.
]
}
]
}