Hey guys!
I’m building a product inventory app that allows a user to checkout stock etc.
So the user can create a new product with a name and the total stock on hand.
This newly created product will also have an attribute called “Owner” that is a ‘User’ and will be saved as the ‘current user’.
Now the user can check out a list of products as well as enter the quantity of each product they check out.
For example, there are 12 Apples in stock and 6 Oranges.
The user then checks out 2 Apples as well as 3 Oranges. Thus in the list of products, 2 should be deducted from the current 12 in stock apples as well as 3 oranges from the 6 in stock oranges.
What I’m struggling with is that on checkout, the app should reduce the corresponding product’s stock with the checkout stock to accurately keep stock.
I can’t find a way to search for products and minus X amount of stock without affecting other stock amounts.
Please help.