Recipe: add variations to a variable product
Variations depend on the parent product’s complete attribute set. Inspect that parent before preparing any child records.
Read product [PRODUCT ID] and confirm it is variable. Read its attributes and
existing variations. Map the requested combinations to exact parent attribute
names and option values. Show missing, duplicate, and conflicting combinations.
Prepare variation payloads with prices, SKU, stock, status, and image where
specified. Run wc_batch_update_variations with dry_run enabled and show every
per-entry result. Wait for confirmation, apply once, then read all variations
back and compare them with the requested matrix.
Matrix review
Each variation should use options already present in the parent attribute definition. Check SKU uniqueness across the store and make price and stock decisions per combination. Omitted stock data is not visible in the variation list response, so read individual variations when stock verification matters.
The batch operation is a loop rather than a transaction. It can apply earlier entries before a later one fails. A batch-level dry_run: true keeps every entry read-only. During a write batch, an entry can independently request a preview. Standard transport skips update entries without an ID; native transport rejects the invalid batch before execution. Inspect every result instead of relying on the batch’s overall completion.
The MCP tools can delete a variation, but deletion should be a separate, explicitly confirmed task.
Related guides: variation tools, batch update reference, and create the parent product.