L.B.
Yes, pack snacks but healthy ones, and never bribe snacks. Just things for him to eat if he's hungry. It's hard for anyone to be in a good mood when they're hungry.
Don't shop later in the afternoon if you can help it. Same thing. Tired = cranky.
YES be willing to leave if he won't mind you.
Never bribe. Never give in, or he'll learn a lot of the wrong kind of persistence! And he learns to misbehave till Mom and/or Dad gives him something. Sets you up for an arms race you can't win. Plus, they learn to do the right thing and be kind not for its own sake but just as a matter of what's in it for them.
Before you leave the house, and on the way before you go into the store, tell him what you're doing and what you're going to get (and what you won't be getting, like treats, toys, etc.). And tell him what behavior you expect.
And just avoid the aisles where the stuff is that he wants. Maybe hit those aisles when he's with Dad and stock up.
Keep talking to him, interacting in various ways. Show him interesting things. Make it fun for both of you without it having to be about who gets what, and about it being about getting stuff, and he'll start to enjoy it for the attention and love he gets, the games you play, etc. Ex, I once saw a father pushing the cart away just a little with his litle son in the seat, and saying, "now where to you think you're going? You come back here!" with a big smile on his face, son giggling. You get the idea :)
L.