cancel
Showing results for 
Search instead for 
Did you mean: 

Link created simple products to configurable product

Link created simple products to configurable product

Hi,

 

i'm trying to link some simple products to their configurable product via REST API in Magento 2.0.2.

 

The JSON data that i send to create a simple product it's:

 

{"product": {
"sku": "PA0001380001", 

"name": "PANTALON PPT 40",
"attribute_set_id": 9, 

"price": 0,
"status": 1, 

"visibility": 1,
"type_id": "simple", "weight": 0,
"custom_attributes": [
{"attribute_code": "sgi_color_01","value": "256"},
{"attribute_code": "sgi_size_02","value": "200"},
{"attribute_code": "options_container","value": "container2"},
{"attribute_code": "required_options","value": "1"},
{"attribute_code": "has_options","value": "1"},
{"attribute_code": "tax_class_id","value": "2"}
]
}}

 

and the json to create a configurable product:

 

{"product": {
"sku": "0001381",
"name": "PANTALON",
"attribute_set_id": 4,
"price": 0,
"status": 1,
"visibility": 4,
"type_id": "configurable",
"weight": 0,
"custom_attributes": [
{"attribute_code": "meta_title","value": "PANTALON"},
{"attribute_code": "options_container","value": "container2"},
{"attribute_code": "required_options","value": "1"},
{"attribute_code": "has_options","value": "1"},
{"attribute_code": "tax_class_id","value": "2"}
],
"extension_attributes": {
"configurable_product_options": [
{"attribute_id": 166,"label": "Color","position": 0,"values": [{"value_index": 256}]},
{"attribute_id": 162,"label": "Talla","position": 1,"values": [{"value_index": 200}]}
],
"configurable_product_links": [44]}

}}

 

both products are correctly created, but in the configurable doen't appear the simple product linked.

i appreciate our help.

thanks,

 

Ivan