Stock keep inventory of individual components which are used to make the SKUs

All of my SKUs are made to order as purchased online and each SKU is made of selected components. The SKUs are listed with variants, so for example Size 8 (product) is sold in packs of 4 to 15 colours (as variants) and a customer will order a “size 8 6-colour” set. When a customer orders I’d like shopify to deduct the individual components from stock.

How do I do this?