When was the last time you made an impulse-buy of candy during checking out on Amazon (AMZN) - Get Report ? If your answer is never, you're probably not alone.

According to a note from Credit Suisse analysts Wednesday, June 13, the prevalence of online shopping and in-store pickup will weigh heavily on Hershey Co. (HSY) - Get Report . That's because, when shoppers pay online, they're far less likely to impulsively buy one of those candy bars that line checkout counters.

"We believe that the shift in shopping patterns to more convenient methods like online and click-and-collect will materially reduce the number of impulse purchase occasions for confectionery products merchandised at traditional checkout aisles," analysts wrote. "We expect Hershey's operating margin to head lower over the next two years as it increases its investment spending to contend with this challenge and struggles to raise prices to offset higher cocoa input costs."

Credit Suisse slashed its price target for Hershey stock to $80 from $90, representing about 11% downside for shares from their current value. Analysts also hit Hershey with a new underperform rating, down from a previous neutral rating.

Hershey stock tumbled 3.2% to $90.38 on Wednesday. The stock is lower 20% year to date.

The "shift to convenience shopping" that favors online and in-store pickup will result in a 0.5% per-year headwind to Hershey's sales, Credit Suisse said. Analysts added that Hershey's marketing material pointed out that 25% of shoppers in click-and-collect formats have cut back on snack purchases because those snacks aren't displayed at checkout.

"We assume convenient shopping methods increase to 33% of the market by 2025 including an increase in click-and-collect and online home delivery to 20%," analysts wrote.

While Hershey may face an outsized impact, the entire category remains at risk. "The confectionery category has grown at a rate of only 0.7% annually over the past three years compared to a much faster 2.9% rate for broader snacks," analysts noted.

Source: Credit Suisse

Both Credit Suisse analysts and Hershey management have attributed confectionery weakness to a growing consumer preference for healthier snacks and increasing concern over sugar consumption. In the overall snack industry, there has been a 12% increase in the number of brands since 2014. In the confectionery space, there has been just a 1% increase.

Already-concerning purchasing trends that favor online and reduce impulse buys are compounded by this shift in consumer preference for healthier snacks. When shoppers are motivated enough to purchase a snack without impulse, they're more likely to reach for something healthier than a Hershey bar.

What's more, Hershey could be particularly vulnerable, Credit Suisse said. Sales have declined 1% and its confectionery market share has dropped 30bps over the last year as Mars becomes more competitive and Ferrero introduces Kinder Joy in U.S. markets.

Source: Credit Suisse

But there is some good news for the legacy Hershey brand. As part of a new $550 million snack platform, Hershey bought Amplify Brands, the maker of "blockbuster brand" SkinnyPop, last year. It's grown 13% in the last year.