If you happen to be shopping with a child, make sure they aren't hungry either. This will help them from be less cranky and/or whiny. Another trick is to bring along something to keep them busy, so you can focus more of your time on shopping.
As a rule of thumb, make sure you have a meal or at least light snack prior to your trip. At the very least chew a stick of gum or suck on a piece of hard candy.