Update product
Change a product name, status, price, sale price or stock.
PATCH https://cotlet.dev/api/v1/woocommerce/products/{product_id}
Updates one product. Change the regular price or the sale price, switch the status between draft, pending, private and publish, or set the stock quantity with manage_stock. Prices are strings in the store currency, and an empty sale_price ends the sale. A published product changes on your storefront at once, so the call is treated as reaching your customers. By default you confirm each call; you can switch that off for this tool.
Parameters
| Name | Type | Description |
|---|---|---|
| product_id integer required | integer | Product ID from list_products. |
| name string | string | New product name. |
| status enum | enum | draft, pending, private or publish. |
| regular_price string | string | Regular price, for example "14.00". |
| sale_price string | string | Sale price; an empty string ends the sale. |
| manage_stock boolean | boolean | true tracks the stock quantity. |
| stock_quantity integer | integer | Units in stock. Needs manage_stock. |
Request
curl -X PATCH https://cotlet.dev/api/v1/woocommerce/products/311 \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"sale_price":"11.20"}' result = client.call("woocommerce", "update_product", {"product_id":311,"sale_price":"11.20"}) const result = await cotlet.call('woocommerce', 'update_product', {"product_id":311,"sale_price":"11.20"}); cotlet call woocommerce update_product --data '{"product_id":311,"sale_price":"11.20"}' Example response
{
"product_id": 311,
"name": "Linen tote bag",
"status": "publish",
"regular_price": "14.00",
"sale_price": "11.20",
"on_sale": true,
"manage_stock": true,
"stock_quantity": 40
}