One of my long standing clients needed a solution that allows customer to purchase “out of stock” products, and writes a prominent message telling them that their order will be dispatched when the product is back in stock.
Customer came up with the idea of some sort of flag based on products_stock (which is the correct way to do things). But what happens when the product is back in stock – the flagged message would disappear.
I spent 10 minutes thinking on this and decided to utilise the order_status_history feature. Why not set up a new order_status called “Pre Order” and write a message here that shows which products in the order are out of stock. This message would automatically in the account_history and in the admin/orders pages.
I then set out to make the code as quickly as I could to test out the idea, and it seems to work very well whilst keeping code changes to an absolute minimum.
In the Shop Side (account_history_info)
This status happens automatically for any product with a quantity of zero or less in stock. This is done on a per product basis, so the message only lists those products in the order that are problematic for delivery. This message is also repeated in the “thank you for your purchase” email as well.
All in all, a nice little modification that allows the customer to see exactly why they might have a delay in receiving their items, and allows the shopowner to receive fewer emails from customers wondering why they have not yet received their order.