I am developing an Ecommerce website and I have one doubt in my mind. Suppose user added a product in his cart and clicked on checkout and he is transfered to a payment gateway which arises some conditions
- At the same time another user 2 checking out the same product while the user 1 is in checkout process , so should i display the product quantity one less or should i display the same quantity until the user 1 successfully make the payment.
What if user 1 clicked on checkout and never came back from a gateway like he has closed the browser or a tab and i have deducted the quantity when he clicked on checkout button so that user 2 can see the actuall quantity available.
if i don't deduct the quantity when checkout button is clicked and user 2 has also checked out just after the user 1 and product is having limited quantity which have been bought by user 1.
How to handle this situation? I am using php and mysql.