Not to sure if this is the right place to ask this.

But I have more of a Theory Related question then Completely Technical

I want to Propose my Issue at hand and then I'm looking for someone to give me a fresh mind on this and an Alternative way id be able to handle this

So I have this Mobile Ecom application everyone's happy with the application the only complaint has been that the checkout "Placing the Order" Take's to long 30ish Items take around 20/30 Seconds, 1 Item around 3/5

I know why this is, But the issue is I can't Do to much about it. Its a Initial Design flaw on my part.

So essentially When the items are in the cart and they get checked out 2 Things happen 1.I pull that Item from The API backend and then Check that Pulled item A against the Item in the Cart B

So if A has less stock then B then you can't checkout B as an example, Then If all checks out then B is added to a orderline list and Placed in a Order Call.

Now the actual order call for B Takes 1/2 Seconds per instance of B, However Getting A to check against B Take's 2-4ish Seconds Per instance of B, Now from that you can conclude that The more items the Longer A make's this process, But how els do I do this? I have to cater for the fact that Person X and Person Z want Product B(Product being a Can Of paint) Now Person X Adds 10 Of B to the Cart And person Z add's 20 But there are only 25 of B

So Now Person X adds B to cart and keeps shopping While Person Z Adds B and checks out immediately Now person X Adds another item and decides to Checkout But now He requires 10 But theres only 5 left, So Now I need to know that Theres only 5 Left at that Instance.

So How els besides getting another product A to compare against Would I go about this kind of thing?

Small Note before getting asked this i've done what I can or from what my Skill level allows to the API(Not my own) to try and Improve these times

  • Suppose persons X and Z hit the checkout button at the same time. Both see 25 cans available, so they can proceed with the checkout. But then the final order arrives and you have sold 30 cans. How would you handle that scenario? – Bart van Ingen Schenau Apr 1 at 8:26
  • That is a interesting question, I'm not sure how I would prevent that It would more then likely Put the faster Response threw , and then back order the other products, This is kind of the issue im facing I can't think of how id check for everything Unless I do it during the response receive on the api side which I cant do as I have no access to that depth of the api – Someguy Apr 1 at 12:44
  • That is my point. The Order process in the backend needs to be prepared that the stock is too low to fulfil an order and handle that appropriately (reject the order, delay shipping until new stock arrives, etc.). When you have that in place, you don't need the additional check in the Shopping Cart. – Bart van Ingen Schenau Apr 1 at 12:55
  • See sadly my Manager the other dev that works with me only know hows to work in Woocom For Ecom Website's and refuses to listen to reason so I have to use the Woocommerece API And I can't control the Lets say Z is the order X the Packet for the order and C the End point, I can't control anything between point Z and C I can only view the orders then Delete Draft ect u know. – Someguy Apr 1 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.