Page 1 of 1

Prevent Checkout of Products with Out of Stock Status in Saved Carts

Posted: Wed Oct 28, 2020 10:08 am
by heatherbell
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.

Re: Prevent Checkout of Products with Out of Stock Status in Saved Carts

Posted: Mon Nov 20, 2023 11:40 am
by burt
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".

Re: Prevent Checkout of Products with Out of Stock Status in Saved Carts

Posted: Tue Nov 21, 2023 6:01 am
by heatherbell
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".
Tested on latest 1.0.8.21 and see the same as you.
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.