Hey gang,
I’ve built a simple e-commerce platform. Store owners can currently upload products but aren’t yet able to include a quantity (stock level), so here’s what I’m trying to achieve (e.g):
- A store owner has 10 units of a product available
- A customer buys 5 units
- Store owners product is automatically updated with new stock level (5)
I have a couple of data types going on here:
1. Product
A single product.
2. Basket item
This includes a single ‘product’ + additional fields (quantity etc)
3. Order
This includes a list of ‘basket items’ + additional fields
I feel like I need to subtract the ‘basket item’ quantity from the ‘product’ quantity but I only want to do this once the ‘order’ has been created because that’s when a customer has actually paid.
Does that make any sense?