magento2: REST API : Save Product Detail per store view not working
Steps to reproduce
- Install Magento from
2.1
branch. - Deploy Sample Data
- Using REST API catalogProductRepositoryV1 REF: http://devdocs.magento.com/swagger/index.html
Get Key from Admin token API and use that key in
POST /V1/products PUT /V1/products/{sku} with parameter tried with both parameter one by one
- store_id=0
- storeId=0 using following JSON
{
"saveOptions": "true",
"product": {
"name": "Test11_11",
"sku": "TESTOPP_111",
"attributeSetId": "15",
"price": "10",
"weight": "10",
"status": "1",
"visibility": "3",
"customAttributes": [
{
"attributeCode": "manufacturer",
"value": "222"
},
{
"attributeCode": "store_id",
"value": "0"
},
{
"attributeCode": "tax_class_id",
"value": "0"
},
{
"attributeCode": "specialPrice",
"value": "10"
},
{
"attributeCode": "description",
"value": "44332211"
},
{
"attributeCode": "eco_collection",
"value": "1"
}
],
"typeId": "simple"
}
}
Does not support store_id / storeId field , but the information in product does not save to store it save to default Store ID
GET /V1/products has parameter storeId same i had tried with PUT & POST but not working with PUT & POST
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (4 by maintainers)
Commits related to this issue
- Merge pull request #4952 from magento-mpi/MPI-PR-2019-10-31 MPI-PR-2019-10-31 — committed to magento/magento2 by dhorytskyi 5 years ago
I also can confirm that this is not fixed in 2.1.3.
When I POST a product, all attribute values are saved with store_id = 0; After a second, identical request, some (not all) values are saved on store_id 1. Note that the values that are saved for store_id 1 aren’t event present in my original request!
This is the request:
After the second time this request is sent, the following attributes are re-saved for store_id = 1:
Please, can anyone confirm this bug and reopen this ticket? This behaviour pretty much makes using the REST API pretty frustrating, since you’ll end up with clutter in your database everytime the API is called. Especially when you think you changed a products’ attribute, but then later on discover there was a value on storeview-level that is overriding your changes!
edit:
A workaround currently to make sure it only is updated for store_id = 0 is by using this suggestion and adding
all
to the URL:This will give the expected behaviour. However, I still the current behaviour should be considered a bug since doing the same request twice results in different results.
To update product for a store view, you can use
rest/store_view_code_not_id/V1/products/sku
and then PUT json: