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

Start free trial

Set Product Attributes

store/set-product-attributes replaces a product’s attributes — size, colour, material — with the set you give.

It replaces rather than merges, so send the full set you want to end up with.

At a glance

Abilitystore/set-product-attributes
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

Descriptive, or an axis

An attribute does two different jobs depending on one flag. Without for_variations it is descriptive: it shows in the additional-information table and nothing else. With it, the attribute becomes an axis the product varies along, and store/generate-variations will build a variation for every combination of the flagged attributes.

Which means changing that flag on an existing variable product is consequential. Adding an axis multiplies the combinations; removing one leaves existing variations referencing an attribute that is no longer varying.

Replacement is the right primitive here even though it is blunter than merging: attributes are a set, the order matters for display, and a merge would have to invent rules for what happens when two entries share a name.

The visible flag controls whether the attribute shows on the product page. An attribute can be an axis without being displayed.

Input

NameTypeRequiredWhat it is
idintegerYesProduct ID.
attributesarrayYesEach entry takes name, options (an array of values), and optionally visible and for_variations.

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 size and colour as the varying attributes on product 812.

It resolves to one call:

{
  "ability": "store/set-product-attributes",
  "parameters": {
    "id": 812,
    "attributes": [
      { "name": "Size", "options": ["S", "M", "L"], "visible": true, "for_variations": true },
      { "name": "Material", "options": ["Organic cotton"], "visible": true }
    ]
  }
}

Worth knowing

  • Replaces the whole set. Include the attributes you are keeping.
  • for_variations is what makes an attribute an axis. Without it the attribute is descriptive only.
  • Adding an axis to an existing variable product multiplies the variations it needs.
  • Idempotent.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading