No matter what, retailers have to deal with inventory inaccuracies. There are lots of reasons why: human error, damaged items, theft, etc. Therefore, the stock information in the ERPs can't be trusted too much, and there's always the risk of overselling or underselling products. The problem is even worse in an omnichannel environment, where the same stock is shared across online and brick-and-mortar stores.
Overselling is one of the worst experiences a customer can have. Imagine buying a product online and then receiving a notification that the product isn't actually available. It is likely that customer service will try to resolve the issue by offering alternative products or even a discount. Anyhow, you lose trust in the brand as a customer, and you might want to explore some alternatives online that are just a click away.
To mitigate the risk of overselling products, most merchants set inventory thresholds. It's simple: if your system shows that you have X items in stock, you only consider (X-T) items as available, where T is the inventory threshold.
The higher the threshold, the lower the chance of overselling. It is possible, however, that you will undersell your products if the threshold is too high. This is when you report an out of stock message on your website when the item is actually in stock. This is also not a good customer experience, since seeing an out-of-stock item is not fun. Furthermore, underselling a product obviously has a negative impact on the business.
That's why it's so important to determine the right inventory threshold. A threshold should not be too low to prevent overselling, but not too high to prevent underselling.
You should also remember that in-person purchases are always prioritized over online sales. When a customer tries to purchase an item online, if your commerce engine reports the item is unavailable, the add to cart button will be disabled and the customer won't be able complete the purchase. When you shop in store, instead, a sales assistant will always sell you an item that is physically there, regardless of what their inventory system says. An out of stock message in their POS system will not prevent them from making a sale. Since the sales assistant's commissions are based on sales and hitting targets, he or she will likely make the sale even if the item has been reserved online.
The online store will not stand by. Despite the system flagging an item as out of stock, an optimistic checkout approach is always possible. Getting more sales is always the priority for every channel. It is our responsibility as developers to take this into account when designing the commerce stack and workflows. Basically, it is the same as database race conditions, where two threads or processes attempt to access the same resource simultaneously and cause problems. Only difference is that the resource is in the form of a physical product instead of a database raw. However, I can guarantee there won't be any less fierce competition to access that resource.
I'll wrap up with a word about safety stock, which is different from inventory thresholds. Also known as "buffer stock" or "backup inventory", safety stock is extra inventory retailers buy to mitigate the risk of a stockout. Retailers can access safety stock inventory in case of unexpected demand fluctuations, supplier delays, or other supply and demand uncertainties. In some cases, such as hospitals and pharmacies, maintaining a safety stock is required by local law to handle emergency and urgent situations.