30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Set Product Images

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

Abilitystore/set-product-images
ToolsetWooCommerce — toolset/woocommerce
GroupWooCommerce › Products & Variations
RequiresWooCommerce, active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI 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

NameTypeRequiredWhat it is
idintegerYesProduct ID.
image_idintegerNoAttachment ID for the main image. Pass 0 to remove it.
gallery_image_idsarrayNoAttachment IDs for the gallery, in display order.

What comes back

NameTypeWhat it is
productobjectThe product after the write.
lookup_stateobjectWhether 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.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent 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_id of 0 removes the main image.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading