I have a 4 1/2 and 2 1/2 and 1 yo that come with me EVERYWHERE including EVERY trip to the grocery store. Their dad always travels, we have no sitter budget. Thus discipline has always been top priority.
I don't allow the mammoth toy car carts for my own sanity (though more power to people who like them) except on "birthdays" and god knows we don't go to the store on birthdays so we've never used one. I need all the space in my cart, so the older 2 have to walk with me, which they do very well. And when they don't, they get disciplined, and then they're back in line for another few weeks until they gradually try to get away with running further and further away down the aisles and using one or two more warnings before coming when called, and then we "refresh" their memories about what's allowed. Usually when my 2 1/2 yo son doesn't come until I "take a few steps toward him" I know it's time for a tune up.
Before anyone jumps down my throat for being mean, let me repeat: They come with me EVERY TRIP to the store, we have a blast, they are super good, and well known by all the clerks and they pretty much ALWAYS get a lollipop for good behavior. People fawn all over them. But more importantly to me, for safety, they need to stay with me. So.
What you HAVE to do, is -first let me say, this starts at home much younger, and will take more perseverance now that they are used to running a muck, but it will work if you are absolutely consistent. You have to teach them to come when you call them the SECOND time you ask them calmly. Once you have asked them once calmly, they need a consequence the second time you ask. As in a good sting on the butt, calmly delivered, every time. I have never seen time outs work for this. They will start to come or stay with you when you ask.
Again, this starts at home, and we all know kids are worse when they get out in public where they're "safe" from consequences. If you always call them 7 times before you deliver a consequence, they won't even think about listening until you have asked 7 times and started to get shrill and desperate. Don't do it. One calm warning. That's it.
You're not punishing out of anger, they are choosing a consequence by ignoring your warning.
"No running away". "No screaming" etc. One warning, then consequence. Yup, that's what bathrooms are for. I KNOW, it's huge hassle to drag all the kids and the full cart to the restroom, and someone's always in there. blah blah, but don't worry, you wont' have to do it many times. Wait until it's all clear. Take junior to the restroom, get eye level and say to him calmly, "I have asked you x times to stop running." STING. As many swats as years old. Give him a minute to compose, and shop again. Repeat if necessary. Once they realize you WILL do it, they choose against the action.
Because this was consistent at home from an early age, my kids were both cured of this by around age 2, but like I said, they do regress at times. My 4 1/2 yo daughter has had to be given a swat in the grocery restroom once, and my 2 1/2 son once and THEN, he still wasn't quite staying within 20 feet of me, so I did give him one quick swat right out in the store-which he didn't think I would do, and he hasn't tested me again in the past 4 months.
This works for tantrums to. Our kids do not have tantrums.
Again, you should "perfect" his at home first, and then you'll have to re-assert yourself in public a couple of times, but you will prevail and have nice sons walking with you. Unfortunately, there is no easy way to get the little angels to just follow behind you like fuzzy little quiet ducklings. It takes work. you have to be the bad guy. Always be calm and brief. No yelling, no grudges. It's SO worth it when it clicks. My kids help me shop, we have fun pointing things out, they help with baby sister, they know where all the groceries are, it's some of our best times. My 2 1/2 yo likes to be given things to find. Discipline is not mean, it's necessary for happy good kids. Good luck!
2 great books are "To Train Up a Child" by Michael Pearl-ignore the scandal and fundamentalist christian stuff and the scary reviews-just read it and keep an open mind-you don't have to use it, but it works-
and a great book by a grandma called Back To Basics Discipline-see parts for free at the site www.backtobasicsdiscipline.com.