store/set-product-images sets a product’s main image and its gallery from attachment IDs.
Upload the files through the media abilities first, then pass the IDs here.
At a glance
| Ability | store/set-product-images |
| 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 |
Checking the IDs first
WooCommerce stores image references as attachment IDs and does not check them. Point a product at an ID that is not an attachment — a post ID, a deleted attachment, a number from a different site after a migration — and the product saves cleanly and then renders a broken image.
That is a failure that surfaces to customers rather than to whoever made it, so every ID is verified to be a real attachment before anything is written. A bad ID is a refusal naming it.
The gallery is ordered, and the order you send is the order it displays in. Sending the gallery replaces it entirely.
Passing 0 as the main image removes it.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
id | integer | Yes | Product ID. |
image_id | integer | No | Attachment ID for the main image. Pass 0 to remove it. |
gallery_image_ids | array | No | Attachment IDs for the gallery, in display order. |
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:
Set the main image and gallery for product 812.
It resolves to one call:
{
"ability": "store/set-product-images",
"parameters": {
"id": 812,
"image_id": 2201,
"gallery_image_ids": [2202, 2203, 2204]
}
}Worth knowing
- Upload through the media abilities first; this takes IDs, not files.
- Every ID is verified. A bad one is refused, not stored.
- The gallery is replaced wholesale, in the order given.
image_idof0removes the main image.
Related abilities
- Get Product — see the current images
- Update Product Details — the other product fields
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category