by Jim » Fri Dec 07, 2007 7:05 am
If the order was started before the item was deleted and completed after you delete it this might occur.
Once the item is added to the cart it is not checked again to see if the item is still in the database unless inventory tracking is enabled. So if someone added an item to the cart and waited a few days to finalize the order they could still have the item in the cart and checkout. The amount of time that a non-completed shopping cart is kept would come into play here, the default time is 7 days and can be configured on Commerce Setup > Order System > Shopping cart in the field "Keep unfinished shopping carts:" So a person would have 7 days to complete the order once they put an item in the cart.
If you have inventory tracking enabled the database is checked to see if the item exists and is in stock when the item is placed in the cart. Each time the cart is recalculated (done on the initial shopping cart screen) the quantity is checked to see that there are still enough to complete the order. Once the quantity drops below the " Out of Stock limit:" set for the product the shopper would get an error saying the item is out of stock. The inventory quantity on hand is not reduced until the thankyou.cgi is executed when the shopper actually finalizes the order by paying for it . So this does leave a small window when a shopper could checkout with an item that is no longer in stock.
So if you have limited stock of items I would turn on inventory tracking and set the number of days uncompleted shopping carts are kept to 1 day. This would minimize the possibility of the problem happening.