store/adjust-stock sets, increases or decreases a stock level, and returns the level before and after.
It routes through WooCommerce’s own stock handling, which does five things a direct write does not.
At a glance
| Ability | store/adjust-stock |
| Toolset | WooCommerce — toolset/woocommerce |
| Group | WooCommerce › Inventory |
| Requires | WooCommerce, active on the site |
| Capability | manage_options |
| Safety | Writes data |
| Repeatable | Not idempotent — each call changes the row set, so re-running is not a no-op |
| Ships in | AcrossAI Abilities Manager 0.0.34 and later |
What the proper path does
It finds the record that actually holds the number — the parent product, for a variation managed there — rather than writing the field you happened to name.
It updates without losing a concurrent change. Stock is the one number on a shop that two processes genuinely do write at the same moment: a customer checking out while an assistant adjusts. A read-modify-write loses one of them; WooCommerce’s path does not.
It recalculates whether the product counts as in stock, which is a derived value that depends on the quantity, the backorder setting and the low-stock threshold together.
It refreshes the hidden term the catalogue uses to hide sold-out products. Without that, a product restocked to twenty stays hidden from the shop.
And it fires the events inventory integrations listen for — the hooks a stock synchronisation plugin or an accounting integration is waiting on.
Increase and decrease are the right operations for most real adjustments. Setting an absolute value is correct after a stock count and wrong after a delivery, because the number you read a minute ago may already have moved.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
id | integer | Yes | Product or variation ID. |
quantity | integer | Yes | The amount to set, add or remove. |
operation | string | No — defaults to set | set, increase or decrease. |
What comes back
| Name | Type | What it is |
|---|---|---|
before | integer | The level before the change. |
after | integer | The level after it. |
success | boolean | Whether the call completed. |
message | string | A one-line summary of what happened, suitable for showing a human. |
error_code | string | Present only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation. |
Example
Ask your assistant:
Twelve more of product 812 arrived today.
It resolves to one call:
{
"ability": "store/adjust-stock",
"parameters": {
"id": 812,
"quantity": 12,
"operation": "increase"
}
}Worth knowing
- Use
increaseordecreasefor deliveries and breakages;setonly after a count. - Not idempotent when increasing or decreasing — running it twice applies it twice.
- The write lands on the authoritative record, not necessarily the ID you passed.
- Restocking a hidden sold-out product makes it visible again automatically.
Related abilities
- Get Stock — check which record is authoritative first
- List Low Stock — what to reorder
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category