Thank you @corsonr again.
I tried the same payload by just changing the ids of the attributes to match with my data, still it doesn’t reflect in the product attributes.
Please check the requested payload and response payload as below.
{
"name":"Ship Your Idea",
"type":"variable",
"description":"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
"short_description":"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
"categories":[
{
"id":9
},
{
"id":14
}
],
"images":[
{
"src":"http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_front.jpg’"
},
{
"src":"http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_back.jpg’"
},
{
"src":"http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_front.jpg’"
},
{
"src":"http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_back.jpg’"
}
],
"attributes":[
{
"id":2,
"position":0,
"visible":false,
"variation":true,
"options":[
"Black",
"Green"
]
},
{
"name":"Size",
"position":0,
"visible":true,
"variation":true,
"options":[
"S",
"M"
]
}
],
"default_attributes":[
{
"id":2,
"option":"Black"
},
{
"id":1,
"option":"S"
}
]
}
Response Payload
{
"id": 56,
"name": "Product",
"slug": "product-5",
"permalink": "http://localhost:8080/woo/product/product-5/",
"date_created": "2021-03-18T19:09:47",
"date_created_gmt": "2021-03-18T13:39:47",
"date_modified": "2021-03-18T19:09:47",
"date_modified_gmt": "2021-03-18T13:39:47",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"on_sale": false,
"purchasable": false,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"in_stock": true,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"categories": [
{
"id": 15,
"name": "Uncategorized",
"slug": "uncategorized"
}
],
"tags": [],
"images": [
{
"id": 0,
"date_created": "2021-03-19T00:39:47",
"date_created_gmt": "2021-03-18T13:39:47",
"date_modified": "2021-03-19T00:39:47",
"date_modified_gmt": "2021-03-18T13:39:47",
"src": "http://localhost:8080/woo/wp-content/uploads/woocommerce-placeholder-450x450.png",
"name": "Placeholder",
"alt": "Placeholder",
"position": 0
}
],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"price_html": "",
"related_ids": [
34,
37,
32,
36,
31
],
"meta_data": [],
"_links": {
"self": [
{
"href": "http://localhost:8080/woo/wp-json/wc/v2/products/56"
}
],
"collection": [
{
"href": "http://localhost:8080/woo/wp-json/wc/v2/products"
}
]
}
}
Have I missed anything important? Please help to find it out.
-
This reply was modified 5 years, 1 month ago by
buddhika23.