Variations

Import sizes and colours as real WooCommerce variations

A T-shirt in four sizes and three colours is one product with twelve variations, each with its own price and stock. Here is how supplier APIs describe them, and how they arrive in your shop the right way.

1 What a variable product is

In WooCommerce a variable product is one product page with options to choose from, such as size and colour. Each combination is a variation with its own:

  • price and sale price,
  • stock,
  • SKU,
  • picture.

Importing each combination as a separate product clutters your shop and splits the reviews. Importing only the parent loses the stock of each size. Getting variations right matters.

2 How suppliers send variants

Every supplier API puts the options in a list inside the product, but they describe each option differently. The common shapes:

Attributes as name and value

"variants": [
  { "id": "1042-R-M", "price": 9.50, "stock": 12,
    "attributes": { "Color": "Red", "Size": "M" } }
]

A list of options

"variants": [
  { "id": "1042-R-M", "price": 9.50,
    "options": [ { "name": "Color", "value": "Red" },
                 { "name": "Size",  "value": "M" } ] }
]

Option names on the product, values on the variant

Shopify-style feeds name the options once on the product, then give each variant option1, option2, or a title such as Red / M:

"options": [ { "name": "Color" }, { "name": "Size" } ],
"variants": [
  { "id": 501, "title": "Red / M", "option1": "Red", "option2": "M", "price": "9.50" }
]

Some APIs also refer to an option by its ID instead of its name. TechCare API Product Sync reads all of these shapes.

3 How the variants are detected

When you press Test connection & detect fields, the plugin looks for the list of variants inside the first product, under names suppliers commonly use such as variants, variations, skus or children, and fills in the variant fields for you.

Switch the view to Advanced and open Variable products to see what it found. The Variants array path is where the list sits in the product; every other variant field is read from inside each item of that list.

4 The variant fields

FieldWhat it is forTypical names
Variant IDRecognises the same variation on the next syncid, variant_id, sku
Variant SKUThe variation's SKUsku
Variant priceIts own priceprice
Variant sale priceIts own sale pricesale_price, offerPrice
Variant stockIts own stockstock, quantity, inventory
Variant imageThe picture shown when it is chosenimage, imageUrl
Variant attributesWhich size, colour and so onattributes, options

Fix any field the test guessed wrong, then press Save settings.

5 What you get in WooCommerce

  • One variable product with the supplier's name, description, category and pictures.
  • One attribute per option (for example Color and Size) with every value seen in the variants. The same option spelled differently by the supplier, such as Color and color, becomes one attribute.
  • One variation per combination, with its own price, sale price, stock, SKU and picture.
  • Your pricing rules applied to every variation, exactly as to simple products.

The attributes are created on the product itself (custom attributes). They show on the product page and in the option drop-downs. WooCommerce’s attribute filter widgets work with global attributes, so if you rely on those filters, keep that in mind.

6 Special cases handled for you

  • One “Default Title” variant. Some feeds give every product a single variant even when there is nothing to choose. That product is imported as a simple product, with the variant's price, SKU and stock.
  • No price on the parent. If the product itself has no price, the cheapest variant's price is used for it.
  • A variant with no options. WooCommerce cannot store a variation without attributes, so it is skipped and the log says so.
  • Sale prices. A sale price that is not below the regular price after your markup is dropped, so no fake discounts appear.

7 When the supplier changes the options

  • A new size or colour appears as a new variation on the next sync.
  • A size or colour the supplier removed is deleted from the product, so customers cannot order it.
  • A product that suddenly arrives with no variants at all is treated with care: its variations are taken off sale instead of deleted, because this is often a temporary glitch at the supplier. If they are still missing an hour later, the product becomes a simple product.

PRO The fast Prices and stock update covers variations too, so the stock of each size stays current between full syncs.

8 Importing everything as simple products

If you do not want variations at all, set Product type to Always simple (ignore variants). The default, Automatic — variable when variants exist, creates variable products only for products that have options.

9 Checking the result

  1. Open an imported product in WooCommerce and go to Product data → Variations.
  2. Compare a few variations with the supplier: price, stock and SKU.
  3. Open the product in your shop, choose an option, and check that the right picture and price appear.
  4. Read the Logs tab for any “no usable attributes” messages.

Try it on your supplier’s products

Every Pro feature free for 7 days, up to 50 products, no card needed. Variations are included in the free edition too.

Start the free trial

New to supplier APIs? Start with connecting your supplier’s API.