Update product

Change a product name, status, price, sale price or stock.

PATCH https://cotlet.dev/api/v1/woocommerce/products/{product_id}

write Confirm

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

Parameters: update_product
NameTypeDescription
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
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"}'
Python
result = client.call("woocommerce", "update_product", {"product_id":311,"sale_price":"11.20"})
Node.js
const result = await cotlet.call('woocommerce', 'update_product', {"product_id":311,"sale_price":"11.20"});
CLI
cotlet call woocommerce update_product --data '{"product_id":311,"sale_price":"11.20"}'

Example response

JSON

{
  "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
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.