Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Syarif's avatar

Help me to auto restock product

Hello.. pls help me, i make a pre sell product and i want every day can autorestock product to next day, this my form customers transactions :

  1. Select product: milk
  2. Select date : 12 dec 2019 (this booking date)
  3. Available stock : 123
  4. How much order : 23

So if other customer order with same date 12 dec 2019 available stock 100, and if available stock 0, form number 4 disable.

And than, for next date or other date available stock auto update 123.

U have idea ? Pls share me code to for my project.. thanks u

0 likes
1 reply
bobbybouwmann's avatar

I would probably use a separated table that keeps the count that's connected to the order per date. If you count those items in the database they should together have a max of 123 per date.

I bet you can code this yourself ;)

Please or to participate in this conversation.