Simple Variations is a WooCommerce extension that implements the variations of a WooCommerce Variable product as a selection of components. For example, consider ordering a custom made hamburger where the customer can choose from different types of meats, buns and cheeses. The price of the chosen hamburger would be the sum of the prices of the selected meat, bun and cheese. So, instead of specifying the price for the Cartesian product of the components only the price of the individual components need to be specified. Similiarly, the in stock quantity would be the minimum of the in stock quantities of the selected components. The easiest way to understand the advantages of this approach is to try the buyer demo page and the seller demo page ( Username:sandrasandbox, Password:mc.s1mpl3V17X ). For the seller demo page try adding a Sourdough bun or a new component Onion with the values Red and Sweet as I have pre-loaded the images for these in the Media Library. You may need to reset the demo in case a previous user has left it in a unusual state.

How to Create a Simple Variable Product

First, define the components using WooCommerce product attributes.

  1. Set the product type to Simple Variable.
  2. Display the Attributes pane.
  3. Enter your component name.
  4. Enter the components separated by a |.
  5. If the component is optional check the optional checkbox.

Then, assign prices, quantities, … to the components using WooCommerce product variations.

The Variations pane of a Simple Variable product is different from the Variations pane of the WooCommerce Variable product. Instead of the user creating a variation by specifying the attributes of the variation this plugin automatically generates a “variation” for each component and displays these variations in the Variations pane. A variation in the Variations pane of a Simple Variable product is not the same as a variation in the WooCommerce Variable product pane. These variations are really the components.

  1. Display the Variation pane.
  2. For each component (marked with blue in the example) set the price, the in-stock quantity and other properties.

Tracking Component Stock Quantity

Simple Variations will propagate changes to the stock quantity of a product variation back to the components of the product variation, i.e., reducing the stock quantity of a product variation by one will reduce the stock quantity of each of its components by one. Simple Variations provides a report of stock quantity by components.

To display this report select WooCommerce > Reports > Component Stock from the Dashboard.

Bulk Converting Simple Variation’s Simple Variable Products to Standard WooCommerce Variable Products

Simple Variation’s Simple Variable products can be converted into standard WooCommerce Variable products. Specifically, only the variation data will be preserved, the component data will be removed and the relationship between components and variations will be lost.

From the Dashboard open the WooCommerce submenu (1), then click on the “Convert Simple Variable to Variable” menu item (2). This will display the “Convert Simple Variable Products to Variable Products” page. On this page select the Simple Variation’s Simple Variable products to convert to WooCommerce Variable products (3), then click the “Convert Selected” button (4).

Implementation Details

The Simple Variable product is implemented using the facilities of the WooCommerce Variable product. Specifically, the components are used to automatically generate a WooCommerce Variable product variation for each member in the Cartesian product of the components where the price of the variation is the sum of the prices of the components and in stock quantity of the variation is the minimum of the in stock quantity of the components. The Attribute pane of a WooCommerce Variable product is overloaded to define the component names and the Variations pane of a WooCommerce Variable product is overloaded to set the properties of the components. A hook is installed to propagate changes to the in-stock quantity of variations to its components, i.e. reducing the in-stock quantity of a variation by one reduces the in-stock quantity of each of its components by one. With respect to the MySQL database a Simple Variable product is stored as a WooCommerce Variable product with some additional meta data. The components are also stored as variations differentiated from the "normal" variations by meta data. This means that it is easy to convert a Simple Variable product to a WooCommerce Variable product by removing the "extraneous" meta data and the component variations. A utility is provided to do this. However, as the components will no longer exists the in-stock quantity by components will be lost.

Download

This product is still under development and not yet available for download. There will be a free version and a premium version. The free version will generate the variations in the Cartesian product of components with prices only. The premium version will add support for in-stock quantity. Before I finalize this product I would greatly appreciate any comments or suggestions. You can contact me using my contact page.

Image Author Attribution

The images on the demo pages are from Wikimedia and are either in the public domain or have a Creative Commons license. The required author attributions are below since there is no place to put them directly on the demo page.

Hamburger
By Evan-AmosOwn work, Public Domain, Link
Beef Patty(Hereford Cattle)
By User Robert Merkel on en.wikipedia – US Department of Agriculture, Public Domain, Link
Chicken Patty(Chickens)
By Andrei Niemimäki from Turku, Finland – Friends, CC BY-SA 2.0, Link
Kaiser Bun
By Kobako – photo taken by Kobako, CC BY-SA 2.5, Link
Brioche Bun
CC BY-SA 3.0, Link
Sourdough Bun
By Chris R. Sims (Simsc) – Own work, GFDL, Link
American Cheese
By Steve Spring, Attribution, Link
Swiss Cheese
CC BY 2.0, Link
Cheddar Cheese
By I, J.P.Lon, CC BY-SA 3.0, Link
Red Onion
By © User:Colin / Wikimedia Commons, CC BY-SA 3.0, Link
Sweet Onion
CC BY 2.0, Link