i try to make sure kids are fed/napped/etc before venturing out.
first i divert/distract
then ill remind ie 'you need to sit quietly in the trolly please. now, where will we find the bread do you think?'
remove the cause/object (my dd loves to pull her shoes off, o ill take them and keep them in the nappy bag till we leave)
then bribery 'shall we get some yummy strawberries for afternoon tea?'
if all that fails i get out of there asap. (though thats only happened once or twice in 2 yrs)