There are solutions for that too... if you have space and can plan ahead.
Locked in a grocery store?
Since I work in a grocery store (part time job) I can tell you what to do.
First, go for the perishable items.
There's usual a kitchen unit in every grocery store for cooked stuff, so use that to go through the perishable foods like meat, fish, and vegetables first.
And most of the food is held in freezers in the back (i know because that's where I work), so if you can keep those freezers going you should be fine.
Remember, always eat the best cuts of meat and fish and stuff first.
For example, if I were locked in the grocery store I work at, I'd make use of the oven in the kitchen area and cook myself a bunch of roasted chickens and ducks, stir-fry some veggies and rice and that's my meal plan for the week.
Remember to save some vegetables and fruits that can grow in your local area for planting, in case the Doom lasts longer than expected.
Once perishable items are out or are no longer edible, then switch to non-perishables.
Once those are out, you've either survived the apocalypse and the army has come to save you or you're completely surrounded by zombies and screwed.
The main thing is though, every grocery store will be looted clean (maybe not the back freezers) in the first week.
Better luck growing and hunting your own food or . . .
I'll stop there.
Leave the rest to your imaginations.