I think [and I have no real experience as dd1 was some sort of miracle non-tantruming completely compliant child] that any right minded individual has a right to tantrum in a supermarket.
Is that helpful 
Well, I think most behaviour stems from stress. So I usually find if I rewind one hour I can see the triggers for behaviour in this house. It's usually dehydration, tiredness, sugar rush/crash, or anxiety. If dd1 watches more than 20 mins of tv her mood changes and she becomes more daydreamy and difficult to get to do anything. That could lead to conflict, as I might decide it's all 'chop chop lets go go gadget shopping' and it doesn't suit her mood and we all get stressed.
I think we expect kids to hop between moods and vibes. From in front of tv, to in shoes and ready to shop with no real time to mentaly get ready.
That's just an example. Another would be to go from zooming in a playpark to chilling on a picnic rug for lunch. These are big asks, an adult couldn't do it.
I think consistency and good,clear, quick explanations are the business. I always try to put myself in dd's shoes and see how it would be if I were her. Although sometimes I haven't the energy, and gve myself over to a bad day.
I don't see much point takng a punishment beyond 10 mins to be honest. Toddlers are very here and now really aren't they. And she is still in that toddler zone - although moving into 'young madam' zone.
We have never used punishments, we have focused on 'why's'. So an example would be 'DD, you must hold my hand. If you don't, I will worry about the cars and that won't be nice for me. Help me by holding my hand, so I'm not worried about the cars hurting us'
Had dd not held my hand, I think I'd have gone down the 'well dd, I'm annoyed with you, and a bit hurt and puzzled that you wouldn't hold my hand. We are shopping now, and I'll talk to you more when I'm less cross. You will sit in the trolly and that will be that for now'
Tbh, that would have got to dd1 more than anything else. It sounds so manipulative, but I cannot bear conflict, and will go some to avod it. I try to massage dd1 into doing the right thing.
DOn't get me wrong, she is completely feral in the right, safe environment. On certain things, like supermarket shopping, I am very exacting though. There are so many flame points, it's the pits anyway, and I need to feel we have very secure ground rules in place so I can attempt it without alcohol.
Now I do realise that dd2 is a completely different kettle of fish, and would be more inclined to take on the carpark cars single handed. Or perhaps armed with a dummy. And simply bop me on the head with her dummy should I try for the same explanantion & angry mummy act.
So I'll be coming to you for advice.