Going to the grocery store when you're hungry is the ultimate test in temptation and it's a given that you shouldn't run this errand on an empty stomach. It's good to go when when you've had some food, but an even better time to go is right after you've exercised. Working out can actually decrease your appetite.
Next time you're in need of a grocery-store run, try and go after you've pushed yourself at the gym or taken a challenging bike ride. Just slip your grocery list into your wallet and go directly to the store after your workout (well, maybe after taking a quick rinse to keep the sweat from clogging up your pores). Remember to pack a small snack for after your workout so that your hunger pangs don't distract you from what's on the list.
The dark chocolate-covered cookies will still make your mouth water, but your mind will remember how hard you just worked and it won't take long to walk away from the junk food empty-handed.