Bulk-add a size or color variation across a category

WooCommerceAdvanced~30 min

Before you start

A connected store with the WooCommerce integration enabled and its attribute and variation abilities turned on. The target products must already be variable products that use the attribute you are adding to (for example Size or Color).

You added an XL to the range, or a new color, and now it needs to exist on every product in a category. One at a time that means opening each variable product, going to the Variations tab, adding the row, setting a price, and saving, over and over.

This recipe adds one variation across a whole category at once. It works on products that are already set up as variable and already use the attribute, so it is filling in a gap rather than rebuilding the product. You confirm the exact list before it creates anything.

The prompt
I want to add a [size XL] variation across [the "T-Shirts" category]. These
are already variable products that use the [Size] attribute. Do not create
anything yet.
First, list the products in that category, and read each one's existing
variations so you can leave out any that already have [XL]. Check that the
global [Size] attribute exists and
includes [XL]; if the attribute or the value is missing, create it. Then show
me the exact list of products you would add an [XL] variation to, and wait for
my approval.
Once I approve, create the [XL] variation on each approved product in batches
of [15], setting the price and SKU I give you, and pause between batches. At
the end, list every variation you created with its product.

Why this is safe to run

Nothing is created before your approval. Listing the products in the category and reading the global attribute set are reads, so the only decision point is a list of products you sign off on by name. Because you confirm that list, a product you do not want touched, or one that already has the value, simply stays off it.

The one write to the attribute, if it is needed, adds a value like XL; it does not disturb the values already there. The variations themselves are new additions on products you named, so nothing existing is overwritten. The WooCommerce abilities are off until you turn them on, every create is gated on the manage-WooCommerce capability, and each new variation is recorded in the Activity Log with its parent product.

Already connected? You do not have to paste this. Ask your agent for the “bulk-add a variation across a category” recipe, or just name the category and the value, and it runs the same confirm-then-create flow on your own store.

How it works

  1. List the products in the category you name so you can confirm which ones should get the new variation.
  2. Read each product's existing variations and leave out any that already have the value.
  3. Check the global attribute you want exists and includes the value, and create it if it is missing.
  4. Show the exact list of products that would get the new variation and wait for your approval.
  5. Create the approved variations in small batches, pausing between them.
  6. Report every variation it created with its product and value.

Questions

Will this convert simple products into variable ones?
No. It adds a variation to products that are already variable and already use that attribute. You confirm the target products in the preview, and anything else is left alone.
What if a product already has that size or color?
The agent reads each product's existing variations and leaves out any that already have the value, so no duplicate is created. You still approve the final list before anything is written.