Have you ever stood in the checkout line at the grocery store full of good intentions and a cart filled with healthy food only to cave at the display of candy and chips? You’re not alone. Checkout lines are notorious for unhealthy yet tempting snack offerings. But what would happen if unhealthy snacks were removed from the checkout areas? Good things, a study shows: purchases of candy and chips go down drastically.

In stores that removed things like candy, chocolates, and chips, there were 76 percent fewer purchases of unhealthy snacks.

Six of the nine major supermarkets in the United Kingdom agreed to remove unhealthy snacks from their checkout lines from 2013 to 2017. Researchers used information collected from over 30,000 households who recorded all of the food purchased and brought home starting a year before the policy change and continuing until a year after.

Purchases of snacks from the checkout lines dropped by 17 percent after the new store policy took effect. That means that 17 percent fewer packages of candy, chocolate and chips were bought and taken home from the grocery store once unhealthy snacks were removed from checkout aisles. The number stayed pretty steady — a year later, it was 16 percent.

In 2016-2017 the same researchers, from the University of Cambridge, the University of Stirling and Newcastle University, followed a group of 7,500 people who bought food and ate it before going home. In stores that removed candy, chocolates, chips and the like from the checkout aisles, there were 76 percent fewer purchases of unhealthy snacks compared to the stores that didn’t remove them.

Snacks purchased while waiting in line to check out at supermarkets tend to be unplanned, impulse purchases. They also tend to be unhealthy. Removing such foods from the checkout area can help consumers avoid temptation and potentially promote healthier diets.

The checkout line is a minefield of impulse purchases that can deal a blow to your healthy intentions. Grocery stores can voluntarily change their policies to remove unhealthy foods from the checkout lines and promote healthier food purchases, but the loss of sales is a disincentive. It may be that governments will have to intervene and prohibit stores from selling such foods in the checkout area or create nutrition standards for food items sold to the captive audience waiting in line.

Of course, you can make a choice. Once you are in the checkout line, nothing else goes in the cart.

The study is published in PLOS Medicine.