Sold quantity control

Hello! I’m building my first app and I need a bit of help understanding how to add a function to my app.
I saw this screenshot that shows exactly what I want to do, which is to show to the clients the total quantity of that product that is still available for purchase, considering how many the clients intend to buy.

This is the screenshot that describes what I want, and I was wondering how to add that to the app.

Hello :wave:

Let’s starting by considering the data structure.
You probably have a products collection, each product has an availableQty field.
availableQty is updated when an order is placed.

For the shopping cart experience you will need an orders collection with a relationship to collection order_products, which has a orderedQty field.

When the checkout is complete update the product availableQty = availableQty - orderedQty

Herein lies the problem, doing this as a batch for each product in the order. You need a countdown timer in the list, or a 3rd party making calls to the Adalo API, Make / Zapier / Xano. Read on the forums about pitfalls of countdown timer.

Other problem is possibility for two carts to ‘compete’ for the remaining items, so you must re-check availability prior to check out. For MVP or low volume app, I would not worry about that. For high volume or real world inventory I would use a pre built solution like woo or shopify.

A lot depends on the app you are building and what your needs are

Thank you so much for answering!
The problem I’m running into is the part of the availableQty field in the products collection, or how to add that to the product itself, I just can’t figure it out.

Create a new property? Like this…

Thank you, I feel kind of stupid, but I appreciate the answer, really lol

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.