'How to add bulk products by WP WooCommerce API
I tried to add multiple product at once using WooCommerce API but I can't. Can any one help me.
I successfully added single product but I can't add multiple. (When we go with single product method for huge volume, it's take long time. that's why)
I tried code posted below.
Reference doc:- https://woocommerce.github.io/woocommerce-rest-api-docs/v3.html?php#create-update-multiple-products
End point URL:- https://example.com/wp-json/wc/v3/products/bulk
Data:-
{
"create": [
{
"title": "Premium Quality22",
"type": "simple",
"regular_price": "77.99",
"description": "This is First product description from Balamurugan Ayyasamy",
"short_description": "This is First product description from Balamurugan Ayyasamy",
"categories": [
9,
14
],
"images": [
{
"src": "http://example.com/wp-content/uploads/2021/12/preview_1000-2009446955-2-547x365.jpg",
"position": 0
},
{
"src": "http://example.com/wp-content/uploads/2021/12/preview_1000-2009446955-2-547x365.jpg",
"position": 1
}
]
},
{
"title": "Premium Quality2",
"type": "simple",
"regular_price": "34.99",
"description": "This is second product description from Balamurugan Ayyasamy",
"short_description": "This is second product description from Balamurugan Ayyasamy",
"categories": [
9,
14
],
"images": [
{
"src": "http://example.com/wp-content/uploads/2021/12/preview_1000-1928542175.jpg",
"position": 0
},
{
"src": "http://dev.datanetiix.com/orange_coast/wp-content/uploads/2021/12/preview_1000-1928542175.jpg",
"position": 1
}
]
}
]
}'
I got this response when tried with postman (When I am tried using PHP curl function same result)
{
"code": "rest_no_route",
"message": "No route was found matching the URL and request method.",
"data": {
"status": 404
}
}
Solution 1:[1]
You're using the outdated WooCommerce API reference. Try to use this endpoint instead:
https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-products
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Artemy Kaydash |
