This is my biggest problem with most parents.
Toddlers will start to do this instinctually. From the first time they do it, they are gauging the parental response. Mom and Dad, in general, can't stand the whining and crying and eventually cave. This is how kids fall into the crying and whining for shit which is perpetuated by the parental response. The kid's actually smarter than the parent.
What should be done? Walk away. Ignore it. Period. Giving it attention gives it value. Teaches the child how to handle the parent. Do this twice if it's the first time. If you're attempting to change a child who's learned this, it might take longer. Consistency is ridiculously simple but you have to care enough to carry through.
When my kids were younger than that, I laid out the ground rules everywhere we went. If we were going out or shopping: Hold my hand, if I let go, hold onto my belt loop. Do not ask me for ANY thing at all. If you misbehave, out we go. If you behave and don't ask me for anything, I will get you (something they like that's good for 'em). And I held to my word. Someone gave me a hard time, we left, even if my cart was full. Home or out, the kids need to know the parents mean business.
These parents have no backbone. The kid will always get what he/she wants.
Sad.