For consumers, one of the great things about shopping online is bypassing the queue to check out. For producers of the candy, magazines and drinks often sold there, it's a problem.
In Britain, the country where e-commerce is most popular, about 13 percent of people do all or most of their grocery shopping online. Yet this only accounts for 5 percent of overall spending, suggesting consumers spend more when they visit a store.
That is because online shoppers search for what they need, usually sticking close to their shopping lists. They don't spontaneously buy magazines they opened while waiting to pay, or chocolate to eat on the go.
Elizabeth Clark, a 40-year-old teacher in Liverpool, England, now does most of her shops on the Internet, and says she ends up buying fewer sweets, newspapers, toys, and wine.
(Read more: Clipping grocery bills, without coupons)
"In the supermarket, obviously you walk past it and you see a special offer and you think 'Oh, I'll have that'," she said.
Even though retailers try to do the same thing by flagging special offers at online check-out, it doesn't usually work.
"I always just press 'next, next, next, next' without even reading them, deliberately, because I don't want to be tempted," she said.
The latest survey of European shoppers by IRI found that 73 percent spent more time planning shopping in order to avoid non-essential purchases amid the economic slowdown.
"Shoppers are reducing their impulse purchasing," said Cristina Lazzaroni, who monitors the confectionary market for IRI in Italy, where online shopping is less of a habit.
And when they do buy chocolate at stores, more Italian shoppers are buying larger take-home tablets instead of single-serve snacks, Lazzaroni said, noting that the shift can hurt the bottom line as smaller packages often carry higher margins. IRI said sales of confectionary fell 2.4 percent in Italy in the last year.
Worldwide, the retail confectionery market is worth $196.5 billion, according to Euromonitor International, up 5.6 percent from a year ago. Nearly all sales are from stores, though online made up 0.9 percent this year, up from 0.6 percent in 2008. That is the same amount as purchased through vending machines.
Grocery is one of the last areas of retail to go online, due to challenges around delivery and perishability, but a shift is underway. Amazon.com is expanding its grocery business in the United States and abroad, and traditional grocers are boosting their own digital capabilities as well.
In the United States, Bernstein Research estimates that about one quarter of spending on consumer goods — some $222 billion a year — will ultimately be spent online.
(Read more: Amazon plans majormove into grocery business)
Not surprisingly, nonperishables enjoy the most online purchasing, with skin care products deriving 12.2 percent of sales online, Bernstein found, way ahead of the 2.4 percent average. Confectionary and biscuits were at less than 1 percent.
Of Britain's 7 million online grocery shoppers, only 12 percent visit a confectionery-related webpage, and just half of those actually buy anything there, according to Kantar Media.
When asked about efforts to lift sales online or at check-out, Hershey and Mars did not offer examples or make anyone available to discuss. Hershey said its sales have grown at a rate above the industry average for the past several years.
A Nestle spokeswoman said: "The online channel represents an opportunity for confectionery. It is an important channel for us and we are experiencing much success. The path to purchase for confectionery is nonetheless different online versus traditional channels."
Online grocery sales will roughly double on average by 2016 in five key European markets —Britain, France, Germany, Switzerland, and the Netherlands — the food and consumer goods research group IGD predicts.
That is prompting many retailers to invest in convenience store formats, where shoppers can top up online orders with fresh goods, instead of trekking to large out-of-town supermarkets. They are also building collection points for goods bought online, which is an area where more impulse buys could happen in future.
"This is going to become more and more a magic moment when retailers need to take advantage of having their customer in a buying mode," said John Sheldon, global head of strategy at consultants eBay Enterprise.
While the bulk of grocery shopping looks set to remain in stores, technology is also putting impulse buys at risk there.
Retailers are looking for ways to make payments easier for their customers, either by allowing them to check out their goods on the go on their smartphones or by introducing faster tills, for example by scanning whole baskets.
"The check out is still complex, costly, not terribly consumer friendly," said Simon Hay, chief executive of Dunnhumby, the customer science company owned by the world's third biggest retailer Tesco.
"The biggest value is getting the return shopping trip," he said, noting that items potentially lost at check-out were small and incremental from the retailer's perspective.
The growth of mobile shopping, either in store or on the go, is also a threat, especially as small screens limit the opportunity to try to tempt shoppers with impulse buys.
Mobile transaction volume and value will average 35 percent annual growth between 2012 and 2017, according to Capgemini.
But smartphones also provide new opportunities for location-based promotions that are already driving sales.
Mondelez International, maker of Cadbury chocolate, has committed to investing 10 percent of its global marketing budget, which was $1.8 billion in 2012, in mobile projects.
In one test, its Stride chewing gum teamed up with Google's traffic and navigation app, Waze, to send mobile Stride coupons for retailers near consumers' locations.
Another test, using in-store sensors, tries to turn browsers into buyers by delivering audio or video content to smartphones based on a shopper's gender and approximate age, what products they're looking at, how long they dwell and the time of day.
Anthony Hopper, chief executive of advertising agency Lowe Open, said brands need to change how people buy chocolate, but acknowledges that it won't be easy.
"If you're somebody who on average buys one bar of Cadbury Dairy Milk on impulse once a week, can I encourage you that it's actually better value to buy a pack of four when you're doing your next online shop? It's a long-term strategy," he said.