Phoenix version: 1.0.8.4
I have seen 2 instances today where customers were allowed to purchase out of stock products. When I looked at the stock levels there were minus amounts or less than zero.
I have allow check set to false and I have the out of stock notice module in place. What else should I check?
Thanks.
Prevent checkout of out of stock products?
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Prevent checkout of out of stock products?
Did you have two orders simultaneously where one is some kind of hosted checkout (e.g. PayPal)?
It doesn't reserve the stock until payment is completed. So it is possible to sell an item, redirect to PayPal (or whomever), sell another item, deduct stock for the second item, deduct stock for the first item. Because it already thinks that it sold the first item, it doesn't check stock levels again.
It doesn't reserve the stock until payment is completed. So it is possible to sell an item, redirect to PayPal (or whomever), sell another item, deduct stock for the second item, deduct stock for the first item. Because it already thinks that it sold the first item, it doesn't check stock levels again.
-
14Steve14
- Senior Contributor
- Posts: 922
- Joined: Fri Oct 25, 2019 7:01 pm
- Phoenix Version: v1.0.9.1
- Has thanked: 17 times
- Been thanked: 103 times
Re: Prevent checkout of out of stock products?
I kept having similar problems where customers would buy something that was out of stock. I think these orders were coming from people that had added the items into their carts, not paid on the day, but did complete the order at a later date. This was happening on 1.7.10.
I cant remember what we did to stop this happening as the thread is on another forum, but I think it entailed adding a further check on the stock before allowing checkout to happen, but like I say I cant remember exactly what.
I cant remember what we did to stop this happening as the thread is on another forum, but I think it entailed adding a further check on the stock before allowing checkout to happen, but like I say I cant remember exactly what.
-
lecarlb
- Contributor
- Posts: 316
- Joined: Mon Oct 26, 2020 5:26 pm
- Phoenix Version:
- Has thanked: 48 times
- Been thanked: 9 times
Re: Prevent checkout of out of stock products?
I use stripe where checkout is seamless. That scenario could still be true.ecartz wrote: ↑Wed Aug 18, 2021 6:07 am Did you have two orders simultaneously where one is some kind of hosted checkout (e.g. PayPal)?
It doesn't reserve the stock until payment is completed. So it is possible to sell an item, redirect to PayPal (or whomever), sell another item, deduct stock for the second item, deduct stock for the first item. Because it already thinks that it sold the first item, it doesn't check stock levels again.
-
lecarlb
- Contributor
- Posts: 316
- Joined: Mon Oct 26, 2020 5:26 pm
- Phoenix Version:
- Has thanked: 48 times
- Been thanked: 9 times
Re: Prevent checkout of out of stock products?
The scenario you described could be true. Maybe emptying carts after a set period would help. I may explore the other forum later. Thanks.14Steve14 wrote: ↑Wed Aug 18, 2021 7:56 am I kept having similar problems where customers would buy something that was out of stock. I think these orders were coming from people that had added the items into their carts, not paid on the day, but did complete the order at a later date. This was happening on 1.7.10.
I cant remember what we did to stop this happening as the thread is on another forum, but I think it entailed adding a further check on the stock before allowing checkout to happen, but like I say I cant remember exactly what.
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
-
lecarlb
- Contributor
- Posts: 316
- Joined: Mon Oct 26, 2020 5:26 pm
- Phoenix Version:
- Has thanked: 48 times
- Been thanked: 9 times
Re: Prevent checkout of out of stock products?
Thank you @heatherbell. I guess I used the wrong keywords when searching late at night. I installed the fix with the code change to fix the one error mentioned.
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Re: Prevent checkout of out of stock products?
Note that the hook removes products where products are marked Out of Stock so in your specific use case, ensure products are marked Out of Stock if stock<=0
-
14Steve14
- Senior Contributor
- Posts: 922
- Joined: Fri Oct 25, 2019 7:01 pm
- Phoenix Version: v1.0.9.1
- Has thanked: 17 times
- Been thanked: 103 times
Re: Prevent checkout of out of stock products?
Glad @heatherbell could remember that. I looked through my notes and could not find a mention of anything. After I installed it, it seems to have stopped most of the problems I was having.