store/set-product-taxonomy sets a product’s categories and tags, either replacing what is there or adding to it.
It goes through WooCommerce’s own save path, which does two things a direct term write does not.
At a glance
| Ability | store/set-product-taxonomy |
| Toolset | WooCommerce — toolset/woocommerce |
| Group | WooCommerce › Products & Variations |
| Requires | WooCommerce, active on the site |
| Capability | manage_options |
| Safety | Writes data |
| Repeatable | Idempotent — running it twice leaves the same result |
| Ships in | AcrossAI Abilities Manager 0.0.34 and later |
Two things the save path does
The first is the default category. WooCommerce will not leave a product with no category — if the list would empty, it applies the store’s default. Writing terms directly can leave a product uncategorised, which is a state the catalogue does not really expect and which shows up as a product missing from every category listing.
The second is the hidden product-visibility terms. WooCommerce filters the catalogue on terms like exclude-from-catalog and outofstock, and those are maintained during the save. Terms written directly leave them stale, and the catalogue keeps filtering on what used to be true.
The mode input is the usual replace-or-add question. Replacing is the default because it is unambiguous; adding is what people usually mean when they say “also put it in”.
Categories and tags are handled separately, so you can change one and leave the other.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
id | integer | Yes | Product ID. |
category_ids | array | No | Product category term IDs. |
tag_ids | array | No | Product tag term IDs. |
mode | string | No — defaults to replace | Whether to replace the current terms or add to them. |
What comes back
| Name | Type | What it is |
|---|---|---|
product | object | The product after the write. |
lookup_state | object | Whether the product lookup table still agrees with the product after the write. A mismatch means the shop is answering SKU searches, price sorts and on-sale queries with stale values. |
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:
Also add product 812 to the sale category.
It resolves to one call:
{
"ability": "store/set-product-taxonomy",
"parameters": {
"id": 812,
"category_ids": [96],
"mode": "add"
}
}Worth knowing
- Default mode is
replace. Sayaddwhen you mean add. - A product cannot end up with no category — the store default is applied.
- Omitting
tag_idsleaves tags alone, and vice versa. - Idempotent.
Related abilities
- Get Product — read the current terms
- Bulk Update Prices — reprice a whole category
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category