Skip to content

Cookie settings

Choose which kinds of cookies you allow. You can change your choice at any time via Cookie settings at the bottom of every page. Privacy statement

Necessary

Always on

Needed to log in, keep your cart and remember your choices. These are always on.

Which cookies?
  • weboke_sessie, weboke_klant, weboke_remember: your session and staying logged in
  • weboke_basket: your cart
  • wkBtwIncl: showing prices with or without VAT
  • wok_cookies: your cookie choice, 12 months

Measures which ad leads to a visit or order, so we do not pay for ads that do nothing.

Which cookies?
  • Google Ads via Google Tag Manager (_gcl_au, _gcl_aw), up to 90 days
  • OpenAI Ads, ads in ChatGPT
  • wok_aff: which partner referred you to us (affiliate programme), 60 days

4.6

Country and language

Each country has its own site, with prices and VAT for that country.

View

Module 3 · 3.2

English

Variable products and attributes

Module 3: Products · Reading time: 10 minutes

Learning objective: After this lesson you can set up a variable product with attributes and variations, decide when variations work better than separate products, and prevent problems when you have many variations.

Key concepts: attribute, global attribute (Products > Attributes), local attribute, terms, "Used for variations", variation, default values (Default Form Values), generating variations, bulk editing, price and stock per variation, number of combinations, max_input_vars

One product, several choices

Theehuis Example sells loose sencha in bags of 50, 100 and 250 grams. For the customer, that is one tea with a choice of quantity. For the shop, it is three things, each with its own price, its own stock and perhaps its own weight. That is exactly what a variable product is for: one product page, one description, one place in the search results, and behind the scenes a variation for each choice.

The alternative, three separate simple products, has drawbacks: three pages with almost the same text (duplicate content, lesson 7.1), managing the photos three times, and a customer who has to search for the bag they want. Still, a variable product is not always better. A rule of thumb:

  • Variable if the customer sees it as the same product and only chooses a property: size, colour, weight, grind.
  • Separate products if they really are different or are searched for differently: green and black tea, or a cast-iron teapot and a glass one. Each of those deserves its own page with its own text.

Attributes: the building blocks

A variation is a combination of attributes. An attribute is a property ("Weight") with terms or values ("50 g", "100 g", "250 g"). WooCommerce has two kinds:

Global attributes are created once under Products > Attributes. They apply to the whole shop: "Weight" with the same terms for all teas. The advantages: you type the terms once, the spelling is the same everywhere, and customers can filter on the attribute in the shop ("show all teas in 250 g"). Every global attribute is a taxonomy with its own archive pages if you switch that on.

Local attributes (custom product attributes) are added to one product only. Handy for something that only exists for one product, such as the engraving options of one teapot. The drawback: no filter, and with ten products that have "Colour", you have ten separate lists full of typos.

So for recurring properties (size, colour, weight, material), choose a global attribute.

An attribute only does something for variations once you tick Used for variations on the product. Without that tick, it only appears as information in the "Additional information" tab on the product page. That is useful too: "Origin: Japan" is an attribute without variations.

Creating and filling variations

With the attributes ready, go to the Variations tab. There are two buttons there: Generate variations, which creates a variation for every combination, and Add manually, for one variation at a time.

Each variation has its own fields: SKU, price, sale price, stock, weight, dimensions, an image, and the enabled, downloadable and virtual checkboxes. A variation without a price cannot be bought and does not appear as a choice. This is the most common mistake: generating variations, forgetting the price, and a customer who sees "Sorry, this product is unavailable".

With bulk editing above the list, you set the price, stock or weight for all variations in one go, or increase prices by an amount or percentage. Then you adjust the exceptions per variation.

With the default values (Default Form Values), you choose which variation is preselected when the page opens. Choose the variation that sells best, or leave it empty so the customer makes a deliberate choice. If nothing is preselected, the page shows a price range ("€6.50 to €24.00").

The number of combinations: where it goes wrong

Variations multiply. A teapot in 4 colours, 3 sizes and with or without engraving gives 4 × 3 × 2 = 24 variations. Add a fourth attribute with 5 options and you are at 120. That has consequences:

  • Management. Each variation has its own price, stock and SKU. Keeping 120 rows up to date is a lot of work and prone to mistakes.
  • The product page. Up to a certain number of variations (30 by default), WooCommerce sends all combinations along with the page, so the drop-down lists know straight away which combinations exist. With more variations, the page asks the server for each choice whether the combination exists (via AJAX). That works, but a customer may first pick a combination that does not exist and only then get a message.
  • Saving. When you save many variations, your browser sends a huge number of fields to the server at once. PHP has a limit for that, max_input_vars. If it is exceeded, the last fields are silently dropped: you save and part of your changes is gone. That is why the admin shows 15 variations per page, but with very many attributes and fields you can still hit the limit. Your hosting provider can raise max_input_vars; in most panels you can do this yourself in the PHP settings (lesson 7.2).

What you can do:

  • Only create combinations that really exist. Do not use "Generate variations" with four attributes; add the combinations you sell manually.
  • Offer a property that does not change price or stock not as a variation but as a product option or note (for example an engraving text via a field; there are extensions for this).
  • Sell truly different products as separate products.

Pitfalls

  • Renaming an attribute later. You can rename a term of a global attribute, but existing variations refer to the slug. Test it in your test shop first.
  • Mixing stock at product level and at variation level. Choose per product: stock per variation (usually) or one stock for the whole product.
  • Variation photos. Without its own image, a variation shows the main photo. For colours, you do want a photo per colour.
  • Variations without an SKU. For imports and links with a till system or wholesaler, you need an SKU per variation (lesson 3.4).

In practice: this is what it looks like in WooCommerce

  1. Products > Attributes: create the attribute "Weight" with the terms 50 g, 100 g and 250 g.
  2. Products > Add New: title "Sencha Uji", product data Variable product.
  3. Attributes tab: add "Weight", select all three terms, tick Used for variations, save the attributes.
  4. Variations tab: Generate variations (three variations), then use bulk editing to manage stock and set per variation the price (€6.50, €11.50, €24.00), the weight and an SKU such as SEN-UJI-050.
  5. Choose 100 g as the default value, save and view the product page in a private window.

Other themes show the choice as a drop-down list, buttons or colour swatches; the principle is the same.

Summary

  • A variable product is one product page with a variation for each choice, each with its own price, stock and SKU.
  • Use global attributes for recurring properties; tick "Used for variations".
  • A variation without a price cannot be bought.
  • The number of combinations grows quickly: only create real combinations and watch out for max_input_vars when saving.
  • Sell truly different products as separate products.

Quiz

1. Theehuis Example has added the attribute "Weight", but no drop-down list appears on the product page. What is the most likely cause?



2. Why do you prefer a global attribute over a local attribute for "Colour"?



3. You save a product with 200 variations and afterwards some of your price changes have disappeared, without an error message. What is a possible cause?



4. When do you prefer to sell green and black sencha as two separate products?



Exercise

Exercise A3.2: Your variable product. Enter the address of your shop, the slug or link of a variable product, the number of variations that can be bought in the shop, and the attributes you use for variations (separated by commas, for example "Weight, Grind"). The program looks up the product via the public Store API (/wp-json/wc/store/v1/products?slug=...), without cookies and without adding anything to the cart. Green if the product is of the variable type, the number of variations matches what you entered, and each attribute appears as an attribute used for variations. Orange if the number differs (the shop does not count variations without a price or that are disabled), if an attribute exists but is not used for variations, or for information if you have more than 30 variations. Red if the product cannot be found, is not variable or has none of your attributes.

A question for yourself (not checked): how many combinations would "Generate variations" create with all your attributes, and how many of those do you actually sell?

Exercise A3.2: Your variable product





What you enter and what we find isn't stored. Your browser remembers your answers and whether you've passed the exercise. If you're signed in, we only save that you got the exercise (almost) right in My courses; you can delete that there too.

Further reading

The steps in the knowledge base apply to the WebOké panels; with other providers it works in a similar way.

One moment…

Set up your domains

For each domain, arrange the nameservers, the link to your hosting and who becomes the owner.

Loading your domains…