That is a problem specific to North American/car-centric/suburban cultures, where people buy groceries once or twice a month.
In places where the grocery shops are within walking distance and more integrated with your life, you just make groceries more frequently. Consequently, the food you buy is always fresher.