Skip to main content
Glama

Change a product

wp_wc_update_product
Destructive

Change a WooCommerce product's regular price, sale price, stock quantity, or status while leaving unspecified fields unchanged; invalid values are rejected before saving.

Instructions

WooCommerce: change a product's regular price, sale price, stock quantity or status. Only the fields given change; all of them are checked before anything is written, so a refused call (bad price, unknown status, unknown id) leaves the product as it was. Returns updated and the product as saved (the fields of wp_wc_get_product). Needs manage_woocommerce and the right to edit this product (edit_product), which a site can withhold for single products; no undo point is recorded. Requires WooCommerce.

Input Schema

NameRequiredDescriptionDefault
idYesProduct id.
stockNoStock quantity (enables stock management).
statusNopublish, draft, pending, private or future.
sale_priceNoSame form as regular_price; empty clears the sale price.
regular_priceNoPlain number of at least 0, written with "." or the shop's own decimal separator and nothing else (no grouping, no exponent); empty clears the price.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.10.0

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds substantial context beyond the annotations: validation happens before any write, so a refused call leaves the product untouched, and 'no undo point is recorded' gives the destructiveHint real meaning. Permission requirements (manage_woocommerce, edit_product, withholdable per product) and the WooCommerce dependency are disclosed. It does not state return/error envelope structure, but the operation semantics are well covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, then partial-update semantics, validation guarantee, return value, and permissions in a compact sequence with no filler. Slightly dense/run-on sentences keep it from a 5, but every clause carries information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description correctly explains the return payload (updated + product as saved, fields of wp_wc_get_product). Mutating-operation concerns — atomicity, permissions, reversibility, plugin dependency — are all addressed, so an agent has what it needs to call this safely.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents formats, enums and clearing semantics. The description adds only a summary of which fields exist plus failure examples ('bad price, unknown status, unknown id'); it does not add format or interaction detail beyond the schema. Baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource plus the exact fields it can change (regular price, sale price, stock, status), which distinguishes it from the read-only sibling wp_wc_get_product that is referenced by name. An agent can tell exactly what this tool mutates without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Clear implicit routing: 'Only the fields given change' tells the agent this is the partial-update path, and wp_wc_get_product is named as the shape of the returned product. There is no explicit when-not-use statement or mention of a sibling for full-product updates, but context is unambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools