What would be the best way to notify a client that a product is out of stock after a while? For example, if someone placed a product that is in stock to their cart and just leaves it there without doing checkout, and after a few days the product becomes out of stock. What would be the best way to notify the user of this?
You should notify the people by displaying the "out of stock" status on the product page as well as inside the cart, since there is where people will head if they want to finish their shopping.
Provide as much information as possible (like when will it be restocked, longer delivery times etc.) and give the user the chance to get a notification as soon as the product will be restocked (for example via E-mail).
You could also display similar products, for example if the user had a black iPhone in his cart and this one is sold out you could recommend him the white one instead.
Why not tell the user before the product is out of stock that there are only a few left? Maybe he will return and finish his shopping, of course this could be very annoying if you are nearly out of stock most of the time, since people won't feel that its a legitimate notification instead just pure marketing.
a) (for registered user, or users that have already left e-mail in checkout process) sent e-mail with info on what is out of stock, and offer to finish checkout without that
b) placed info for out of stock on product page
c) placed small notification above the cart icon (usually cart icon is in header)
d) on cart overview / before checkout page, greyed out product, changed its quantity to 0