我想使用 Woocommerce API 更新产品的库存。我设法通过查询产品 ID并使用以下代码来做到这一点:
curl -X PUT \
https://www.kilikili.be/wp-json/wc/v3/products/10340 \
-H ...
-b ...
-d '{
"manage_stock": true,
"stock_quantity": "1"
}'
但是,我现在想通过使用sku来做同样的事情。
我试过这个:
curl -X PUT \
'https://www.kilikili.be/wp-json/wc/v3/products?sku=test' \
-H ...
-b ...
-d '{
"manage_stock": true,
"stock_quantity": "2"
}'
但是,我收到以下回复:
{
"code": "rest_no_route",
"message": "No route was found matching the URL and the request method",
"data": {
"status": 404
}
}
关于如何实现这一目标或是否有可能的任何想法?