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

Start free trial

Create Variable Product

store/create-variable-product creates a product that comes in variations: sizes, colours, and so on.

WooCommerce’s own product create cannot make one. Its type list covers simple, virtual, downloadable, external and grouped products, and stops there.

At a glance

Abilitystore/create-variable-product
ToolsetWooCommerce — toolset/woocommerce
GroupWooCommerce › Products & Variations
RequiresWooCommerce, active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableNot idempotent — each call changes the row set, so re-running is not a no-op
Ships inAcrossAI Abilities Manager 0.0.34 and later

Two steps, on purpose

A variable product is a parent plus one child product per combination of its varying attributes. Creating it is therefore two operations, and this is the first: the parent, with the attributes that will vary marked as such.

The second is store/generate-variations, which builds the combinations. Keeping them separate means you can check the attribute set before committing to the product explosion it implies — three sizes by four colours by five materials is sixty child products.

Created as a draft unless you say otherwise, so nothing appears in the shop half-built. A variable product with no variations is a product customers cannot buy, and it is a real state this exists in between the two calls.

Each attribute needs a name, its options, and for_variations: true to mark it as an axis the product varies along. An attribute without that flag is descriptive only.

Input

NameTypeRequiredWhat it is
namestringYesProduct name.
skustringNoStock keeping unit.
statusstringNo — defaults to draftPublication status.
attributesarrayNoThe attributes to vary along. Each needs name, options and for_variations: true.

What comes back

NameTypeWhat it is
productobjectThe created variable product.
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:

Create a t-shirt that comes in three sizes and two colours.

It resolves to one call:

{
  "ability": "store/create-variable-product",
  "parameters": {
    "name": "Organic Cotton T-Shirt",
    "attributes": [
      { "name": "Size", "options": ["S", "M", "L"], "for_variations": true },
      { "name": "Colour", "options": ["Black", "White"], "for_variations": true }
    ]
  }
}

Worth knowing

  • Draft by default. Publish once the variations exist.
  • Attributes without for_variations are descriptive, not axes.
  • Not idempotent.
  • A variable product with no variations cannot be bought. Run the generation step before publishing.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading