E commerce Inventory management

hello. i need assistance with the app that i am making. Problem i am facing is that my app is failing to update the inventory as a user checks out. the picture below will show my current database structure for size and color

However, this Stucture does not satisfy my needs for the app's functionality. with this structure, i am able to display the product sizes and colous properly but the quantity available is being alocated to the entire product.

WHAT I WOULD LIKE TO ACHIEVE!!

In this case, i would like to achieve an app that is aware of the inventory levels not only for the product as a whole but for the individual colours and its sizes as well.

for example,

white- small- QTY=16

white- medium- QTY=29

blue- small- QTY=2

in this case, when a user checks out, the app should be able to acknowledge that the user checked out product X in white color, size medium. reduce the quantity from 29 to 28 for that string.

I really need Help on this issue and if you have any ideas please help. I am willing to restucture my database if it comes to it. Thank you for your assistance in advance

1 reply