Prevent Checkout of Products with Out of Stock Status in Saved Carts
--------------------------------------------------------------------
Customers can save a product in their cart and checkout at a later date when the product has since had its status changed to Out of Stock.
This hook prevents that by removing products with a status of Out of Stock from the customer's cart when they checkout and displays a message to say so.
Tested on Phoenix v1.0.7.9
Installation
------------
Upload all other than this README file.
There are ZERO over-written files so you are sure to be safe to upload all.
Credits
-------
Thanks to @ecartz for the solution and code.
Prevent Checkout of Products with Out of Stock Status in Saved Carts
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Prevent Checkout of Products with Out of Stock Status in Saved Carts
You do not have the required permissions to view the files attached to this post.
- burt
- Core Team
- Posts: 4551
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Prevent Checkout of Products with Out of Stock Status in Saved Carts
I'm wondering if this is needed in 1.0.8.21 ?
I can't get to the checkout in 1.0.8.21 (haven't tested in anything older) when;
Mickey Mouse adds Green Tomato to cart. Doesn't matter if he logs out or stays logged in.
Admin sets Green Tomato product status = 0 (ie deactivated).
On the next page load, Mickey Mouse gets a message saying;
"Green Tomato has been removed from Cart".
I can't get to the checkout in 1.0.8.21 (haven't tested in anything older) when;
Mickey Mouse adds Green Tomato to cart. Doesn't matter if he logs out or stays logged in.
Admin sets Green Tomato product status = 0 (ie deactivated).
On the next page load, Mickey Mouse gets a message saying;
"Green Tomato has been removed from Cart".
-
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 Products with Out of Stock Status in Saved Carts
Tested on latest 1.0.8.21 and see the same as you.burt wrote: ↑Mon Nov 20, 2023 11:40 am I'm wondering if this is needed in 1.0.8.21 ?
I can't get to the checkout in 1.0.8.21 (haven't tested in anything older) when;
Mickey Mouse adds Green Tomato to cart. Doesn't matter if he logs out or stays logged in.
Admin sets Green Tomato product status = 0 (ie deactivated).
On the next page load, Mickey Mouse gets a message saying;
"Green Tomato has been removed from Cart".
Only exceptions seen are when customer is in the middle of checkout process when the product is deactivated e.g. on checkout_shipping.
Then the message stack does not appear but the product is removed.
If the customer is on checkout_confirmation when the product is deactivated, then clicks Finalise, the order is processed but product is removed from order.
These exceptions are only observations, that is, not saying they are "bugs" or require a "fix".
Conclusion that it now seems impossible to order a de-activated product.