Products, Variations & Inventory
WordPress E-Commerce with WooCommerce
Chapter 2 · Products, Variations & Inventory
Chapter 1 established that a product is, underneath, a post of type product with its price and stock stored as post meta. This chapter goes one level deeper: WooCommerce doesn't have just one kind of product, and one of those kinds — variable products — quietly relies on a second custom post type this course hasn't named yet. Then it covers the two pieces of data every product type shares: SKUs and stock.
The Four Product Types
Every product is assigned exactly one product type, chosen from a dropdown on the product's edit screen. This single setting changes which fields appear on the rest of the screen and how the product behaves at checkout.
| Type | What it is | Typical use |
|---|---|---|
| Simple | One price, one SKU, one stock count — no options to choose | A single physical item with no size/color/etc. choices |
| Variable | A parent product with multiple purchasable variations, each with its own price/SKU/stock, driven by attributes like Size or Color | A T-shirt sold in several sizes and colors |
| Grouped | A collection of existing simple products, displayed and purchasable together, with no price or stock of its own | A "starter bundle" page linking to several already-listed products |
| External / Affiliate | No cart or checkout involvement at all — a "Buy product" button links straight to another site | An affiliate listing that sells through Amazon, Etsy, or a partner store |
Variations: A Second Custom Post Type, Hiding in Plain Sight
A Variable product first defines one or more attributes — for example, Size with values Small/Medium/Large, and Color with values Red/Blue. Each specific combination you choose to sell (Small/Red, Medium/Blue, and so on) becomes its own variation, with its own price, SKU, and stock quantity.
product_variation, with post_parent pointing back to the Variable product's own post ID. This is the exact same parent/child post relationship pattern WordPress uses elsewhere (a Page's own sub-pages use post_parent the same way) — WooCommerce didn't invent a new relationship mechanism for variations, it reused one already built into WordPress core.
Practically, this means a Variable product with 6 size/color combinations is really 7 posts in wp_posts: one product post (the parent, holding the shared title, description, and images) and six product_variation child posts (each holding its own price, SKU, and stock in its own postmeta).
SKUs — Your Own Inventory Identifier, Meeting WooCommerce's
A SKU (Stock Keeping Unit) is a code you assign yourself — WooCommerce doesn't generate or require any particular format. Its only real constraint is that, if you set one at all, it must be unique across every product and variation in the store; WooCommerce will refuse to save a duplicate.
- SKUs are optional at the WooCommerce level, but rarely optional in practice — they're the identifier most shipping carriers, accounting software, and inventory systems expect to integrate against
- A Simple product has one SKU; a Variable product's parent typically has none, since each of its variations carries its own SKU instead
- A sensible SKU scheme (e.g.
TSHIRT-RED-M) pays off directly once Chapter 6 covers shipping classes and Chapter 9 covers reporting at scale — an unplanned or missing SKU scheme is a real, common source of later confusion in a growing store
Stock Management
Stock tracking is opt-in per product, under the Inventory tab of the product editor:
| Setting | What it controls |
|---|---|
Manage stock? | Turns quantity tracking on for this product; leaving it off treats the product as always available |
Stock quantity | The current count — automatically decremented by WooCommerce as orders are placed |
Low stock threshold | Triggers a notification to the store admin, without changing what customers see |
Allow backorders? | Controls whether a product can still be ordered once its stock quantity reaches zero |
Stock status | The customer-facing label — In stock / Out of stock / On backorder |
Hands-On Exercises
A store owner wants to sell a hoodie in three sizes and two colors, each combination priced and stocked separately. Which product type should they use, and why would Simple or Grouped not fit this case?
📄 View solutionExplain how many posts, and of what post types, exist in wp_posts for a Variable product with 2 attributes and 4 total variations, including the parent. Connect your answer to this chapter's own post_parent explanation.
📄 View solutionExplain why an External/Affiliate product's "stock quantity," if set at all, doesn't function the same way a Simple product's stock quantity does.
📄 View solutionChapter 2 Quick Reference
- Four product types: Simple, Variable, Grouped, External/Affiliate — only Simple and Variable go through WooCommerce's own checkout
- Variations are real posts of type
product_variation, children of the parent Variable product viapost_parent— the same WordPress-core parent/child mechanism, not a new one - SKUs are self-assigned, must be unique store-wide, and matter most for shipping/accounting/inventory integration
- Stock management is opt-in per product — quantity, low-stock threshold, backorders, and customer-facing status are all independently configurable
- Grouped and External/Affiliate products don't use stock management the same way, since neither routes through a real checkout of its own quantity
- Next chapter: Store Design