Calm and assertive. Get down on his level and let him know what you need and expect out of him BEFORE you enter the store. Then if behavior isn't as expected follow thru with a pre-determined action, i.e. taking him to the car for a couple minutes. Most important - be prepared to leave if behavior is bad - don't allow bad behavior or reward it just because you have errands or are embarrassed.
Smile. Ahh. You now belong to a very big club! the basic answer is ignore it. It is best not to go if your child is hungry or tired. You are asking for a tantrum. One mother taught me a great lesson...Give your child something he/she wants when you get there (not candy)...A toy or something) so he/she is entertained and quiet. Then put it back before you leave. Everyone is happy and you didn't buy extra!
Tell him how you . Expect him to behave before you go. Briefly state the reward for appropriate behavior & the consequence for tantruming, then follow through. It helps if you can do short "dry runs" to the store so you can "catch him being good." engage him in helping you pick out healthy foods. If you give him food or drink, or scold him when he tantrums, you reinforce the behavior you don't want.