
Updating stock quantity by SKU with Woocommerce API v3
- or -
Post a project like this1837
€30(approx. $34)
- Posted:
- Proposals: 13
- Remote
- #2760631
- Awarded
WORDPRESS ( WOOCOMMERCE AND PLUGIN) AND CMS EXPERT - QUICKEST DELIVERY GURANTEED 12 + YEARS

Wordpress, Shopify, Laravel, Android (Kotlin), IOS(Swift), Flutter, React Native, Firebase

Full Stack Developer| POS System Expert | Hybrid Mobile Application Developer | Web APP Developer | Graphic Designer | UI/UX

Versatile Full Stack Developer: Bridging Frontend Excellence with Backend Ingenuity for Seamless Web Solutions

Full Stack Developer/React.JS/Node.JS/ReactNative/Hybrid Apps /PHP/Wordpress/Shopify/Laravel/WebRTC/Angular/Digital Marketing
⭐ ⭐ ⭐ ⭐ ⭐ Top Rated in Plymouth UK, 17+ Years Professional Experience, A+ Communications

Experienced Software Developer: AI Expert, Web/ Mobile App developer, PHP, MERN, Python/ Django, REST API

2461489599143284115113278541652452263371821873793338481306362127426318142893773883





Description
Experience Level: Entry
I'd like to update the stock of a product with the Woocommerce API. I managed to do this by querying on the product ID and using the following code:
curl -X PUT \
https://www.kilikili.be/wp-json/wc/v3/products/10340 \
-H ...
-b ...
-d '{
"manage_stock": true,
"stock_quantity": "1"
}'
However, I'd like to do the same now by using the sku.
I tried this:
curl -X PUT \
'https://www.kilikili.be/wp-json/wc/v3/products?sku=test' \
-H ...
-b ...
-d '{
"manage_stock": true,
"stock_quantity": "2"
}'
However, I'm getting the following response:
{
"code": "rest_no_route",
"message": "No route was found matching the URL and the request method",
"data": {
"status": 404
}
}
For achieving this, I need a custom endpoint as described in the API documentation: https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/
Due to time constraints, I’m not able to develop this myself. Hence, the request via PPH.
curl -X PUT \
https://www.kilikili.be/wp-json/wc/v3/products/10340 \
-H ...
-b ...
-d '{
"manage_stock": true,
"stock_quantity": "1"
}'
However, I'd like to do the same now by using the sku.
I tried this:
curl -X PUT \
'https://www.kilikili.be/wp-json/wc/v3/products?sku=test' \
-H ...
-b ...
-d '{
"manage_stock": true,
"stock_quantity": "2"
}'
However, I'm getting the following response:
{
"code": "rest_no_route",
"message": "No route was found matching the URL and the request method",
"data": {
"status": 404
}
}
For achieving this, I need a custom endpoint as described in the API documentation: https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/
Due to time constraints, I’m not able to develop this myself. Hence, the request via PPH.

Petasos
100% (1)Projects Completed
1
Freelancers worked with
1
Projects awarded
50%
Last project
22 Mar 2020
Belgium
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies