简体   繁体   中英

E-Commerce / Cart - Stock

just a logic question.
I'm building a shop based on Laravel and other stuff but that's not the point.
The point is, how to handle stock addition / deduction.

Right now, I have a package (my item) with the qty of (let's say) 20 in the shop. Every time a user try to add this item (and the qty) to the cart or updates the qty of the item in the cart, I check if:
- Count of QTY of the PAID orders is < QTY OF ITEM - I do not count the qty of other orders which are not paid.

Is this correct? Or do I have to include orders with "pending payment" or other ?

Quite difficult to find the right way. What is the best way to manage stock ?

I'd say it all depends on how the logic and implementation you want to add is.

Think of it this way on a case-by-case scenario ( me being the customer):

  1. If i am allowed to create an order and never pay for it (changed my mind, out of money, forgot about it)
    • Will you reserve the stock for me forever?
  2. If i create an order, i come back to pay a week later but you are out-of-stock
    • Will you make sure i get the item somehow?
    • Will you prompt me that the stocks have changed for some of my items and i need to review my order?
    • Will you just cancel my order as stock in not available?
  3. If i make an order and while i am trying to find my credit card to pay someone else buys the last items before me, what will you do then?

Conclusion:

  • In case 1 the store is at a disadvantage and probably will face problems for keeping stock for items that are never going to be actually purchased.
  • In case 2 it was my fault for not making sure i paid for the orders promised in a reasonable amount of time so i would accept the scenario of "losing" the item
  • In case 3 it was probably the system's fault for not keeping the items for me as promised when making my order as it could be a matter of minutes or even seconds.

From this i would suggest you used a time based reservation of items, prompting the users to settle their payments in a reasonable amount of time (1 day, 1 week, 1 month... it depends on you) for which their orders are considered active .

By counting the active pending orders and just cancelling them after some time, you would keep customers happy since you are delivering as promised and them feeling obligated to pay their order or risk losing up on the items in their order.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM