I'm familiar with this problem and it still happens sometimes. I've partially solved it by buying groceries more frequently, and by cooking stuff the day I bought it, even if it's for eating it one or two days after. Some foods I've replaced, like freezer spinach instead of fresh or pots of yoghurt smaller than a kilogram.
That's just to throw out less, the whole vitamin thing seems pointless if you don't have deficiencies.