If the problem is too much spoiled stock, wouldn't it be simpler and easier to implement a dynamic-pricing system, where the price of a product starts going down automatically (say, every 6 hours) starting two weeks before the product is marked to be spoiled? I've seen shops do this manually, but it usually only happens when they have a lot of stock of the same product that's about to go bad, so they sell 2-for-1 or something like that.