magento2: POST product with REST API doesn't save manufacturer attribute
Preconditions
- magento 2.3.1 CE
- PHP 7.1.29
Steps to reproduce
I’m able to save a product with a POST request to my REST API endpoint. Now I would like to save manufacture attribute,too. To reproduce this issue send a POST request to insert a product (or a PUT request to update). I prepare this json structure.
{
"product": {
"sku": "code",
"name": "name",
"price": 5,
"attribute_set_id": 4,
"status": 1,
"visibility": 1,
"extension_attributes": {
"stock_item": {
"qty": 0,
"is_in_stock": false,
"is_qty_decimal": false,
"min_qty": "0",
"qty_increments": "0"
}
},
"custom_attributes": [{
"attribute_code": "barcode",
"value": "############"
}, {
"attribute_code": "family",
"value": "product family"
}, {
"attribute_code": "description",
"value": "product description"
}, {
"attribute_code": "category_ids",
"value": ["1", "2", "41", "53", "87"]
}, {
"attribute_code": "manufacturer",
"value": "213"
}]
}
}
Expected result
I’m expecting that all custom_attributes
will be saved to related product
Actual result
This product is saved on my catalog but without manufacturer value, indeed the response about above request is
{
"id": 2059,
"sku": "code",
"name": "name",
"attribute_set_id": 4,
"status": 1,
"visibility": 1,
"type_id": "simple",
"created_at": "2019-06-17 08:02:23",
"updated_at": "2019-06-17 08:02:23",
"extension_attributes": {
"website_ids": [1],
"category_links": [{
"position": 0,
"category_id": "1"
}, {
"position": 0,
"category_id": "2"
}, {
"position": 0,
"category_id": "41"
}, {
"position": 0,
"category_id": "53"
}, {
"position": 0,
"category_id": "87"
}]
},
"product_links": [],
"options": [],
"media_gallery_entries": [],
"tier_prices": [],
"custom_attributes": [{
"attribute_code": "description",
"value": "description"
}, {
"attribute_code": "url_key",
"value": "name-of-product"
}, {
"attribute_code": "options_container",
"value": "container2"
}, {
"attribute_code": "barcode",
"value": "###########"
}, {
"attribute_code": "family",
"value": "product family"
}, {
"attribute_code": "required_options",
"value": "0"
}, {
"attribute_code": "has_options",
"value": "0"
}, {
"attribute_code": "category_ids",
"value": ["1", "2", "41", "53", "87"]
}]
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (10 by maintainers)
@scne can you please use attribute code country_of_manufacture in place of manufacture I am able to save attribute value