Answer the question
In order to leave comments, you need to log in
How to compensate for the delay?
there is a store on the site, it has goods. Due to the high traffic of the site, goods in the store are bought up very quickly and it happens that 2 people buy one product at the same time. There is a check to see if the product was purchased or not, but due to the micro-delay in updating the database, it turns out that the product is bought from two people. How to be?
Answer the question
In order to leave comments, you need to log in
When adding to the cart, it is necessary not only to check for availability, but also to write off (or reserve), then return it if a purchase has not been made
At the time of purchase of the goods, use a transaction and a request of the form select for update
Detailed in the documentation
It can be configured so that the product with less than N pieces left is not available for purchase or is marked something like "remains in stock - unknown". In this case, when approaching the minimum, the user simply will not be able to add the product to the cart instead of a bummer when placing an order, or at least be ready for this bummer, realizing that the product may no longer be available.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question