It's also about product placement. When checking out from grocery shopping many people are hungry because they essentially just got done working out physically and mentally. Their bodies blood glucose is going to be a little lower than normal and they walk into the checkout lane where all the candy and processed carbohydrates are.
Marketing companies know exactly what they are doing by getting their product in the checkout line. Stressed out hungry people are going to have a much harder time resisting a candy bar. Especially when they have to wait in line for 10-15 minutes while the people in front of them are checking out.
Make sure you never go shopping hungry, and if you are going to be shopping for a long time try to bring a healthy snack along with you.