The raw materials are tracked separately from your Shopify products. So they can never be purchased on their own.
You decide which product variants are linked to which raw materials. When a variant linked to a raw material is sold it draws down the inventory of the raw material. All other variants that are linked to that raw material also have their inventory levels updated to match.