Skip to content
◆ WC Design Tool/README.md·~/projects/wc-design-tool
● WordPress plugin

WC Design Tool

role year 2025

A WooCommerce suit configurator for a tailor's shop: staff click through the order with the customer next to them, and the price follows every choice.

WordPressWooCommercePHPReactJavaScript

This one is client work for a Danish tailoring shop that makes suits, vests and shirts to measure. They already had a configurator on their site, but it was pretty much just a simple form. Not that interactive.

So I built a new one as a WooCommerce plugin, with the design tool itself in React.

Recorded on a local test install with demo fabrics and prices, not the shop's own.

A tool for the shop floor

The main tool turned out to be the staff version, not the one for customers. Staff sit in the shop with the customer next to them and go through the order step by step: fabric, buttonhole colour, lining, lapels, pockets, vents, canvas, then the trousers. A full suit is 17 steps.

The total updates with every choice. In the staff tool the price is recalculated during render, so it never lags a step behind what's on screen, and the server checks it again half a second later. When the order goes through, an email with the full spec goes to the manufacturer.

The steps aren't hardcoded. Each one is a category in WordPress, and every option under it is a post with its own image and price, so the shop can change what's on offer without touching code. There's a customer-facing version too, but that one is still a work in progress.

The staff design tool: a sidebar of fabric swatches on the left with Royal Blue Windowpane selected, and on the right the chosen fabric with its composition, weight and price, a notes field and a total of kr. 5.790.
Picking a fabric in the staff tool. Demo fabrics and prices from a local test install.

A whole fabric book, sorted by colour

The shop has a lot of fabrics. They have a whole book of them IRL, and the fabric gallery was a way to show it digitally.

Nobody has to type in a colour for each fabric. The gallery loads the fabric photo into a canvas and samples the middle of it. A solid fabric gets the average colour. A pattern like a pinstripe or a check gets its 3 dominant colours through a small k-means clustering. The detected colour is saved with the fabric, and it gets a Danish colour name too.

Then the colours are sorted around the colour wheel, so browsing feels like flipping through the book instead of reading an alphabetical list:

public/js/fabric-gallery.js
1const sortColorsByHue = (colorsArray) => {
2 return colorsArray.map(color => ({
3 ...color,
4 hsl: hexToHSL(color.hex)
5 })).sort((a, b) => {
6 const aHSL = a.hsl;
7 const bHSL = b.hsl;
8
9 // Put neutrals (low saturation) at the end
10 const aNeutral = aHSL.s < 10;
11 const bNeutral = bHSL.s < 10;
12
13 if (aNeutral && !bNeutral) return 1;
14 if (!aNeutral && bNeutral) return -1;
15
16 // For neutrals, sort by lightness (black to white)
17 if (aNeutral && bNeutral) {
18 return aHSL.l - bHSL.l;
19 }
20
21 // For colors, sort by hue (color wheel)
22 return aHSL.h - bHSL.h;
23 }).map(({ name, hex }) => ({ name, hex }));
24};

Greys and blacks would land in random spots on the wheel, so anything with almost no saturation goes to the end, sorted from black to white.

The fabric gallery: a search field, a row of colour filter swatches from browns through greens and blues to greys, and a grid of fabric cards each with a detected colour dot.
The fabric gallery with the colour filter on top. Demo swatches from a local test install.
note

There's also an AI search in the gallery, so you can describe what you want instead of filtering. It was a bit of an experiment. It runs on deepseek-chat, the API key stays on the server, and each visitor gets 5 searches a minute.