In today's market environment, one stock that faces ongoing struggles is confectionery and snack giant Hershey (HSY -2.35%). The company has dealt with ongoing cocoa shortages that pressure its margins, and the stock has slipped more than 40% over the last two years.

The question for investors is how they should react to these conditions. Although the current business environment and raw material shortages bring significant headwinds for Hershey, investors have good reason for optimism about the chocolate stock. Here's why.

A person eats a chocolate bar while outside.

Image source: Getty Images.

Why Hershey's stock fell

Hershey has left an increasingly bitter taste in the mouths of investors over the last couple of years.

The biggest challenge has been rising cocoa prices. As recently as the fall of 2022, cocoa traded for below $2,000 per metric ton. Now, amid supply shortages, cocoa prices briefly spiked above $12,000 per metric ton, and today, the price is still around $10,000 per metric ton.

Countries such as Ivory Coast produce the majority of the world's cocoa, and with crop yields suffering due to disease and poor weather in those countries, prices shot much higher.

Despite efforts to offer more non-chocolate products, Hershey's candy sales in North America made up 82% of the company's revenue in the first quarter of 2025. Passing rising cocoa costs on to consumers helped Hershey end 2024 with a 0.3% annual gain. Still, net sales fell 14% in the first quarter of 2025 to $2.8 billion.

Moreover, like many businesses, inflationary pressures and the higher interest-rate environment had a chilling effect on growth. Also, recent purchases of Sour Strips and Weaver Popcorn led to high integration costs and worries about its supply chain.

Reasons for optimism

Nonetheless, Hershey remains an entrenched player in the chocolate and snack industry, and a closer look at the stock may show some cause for optimism.

Despite such challenges, Hershey guided for a net sales gain of at least 2% for 2025. That would indicate that its customer base remains loyal to its products even amid expectations that customers may buy less while cocoa prices remain elevated. On its earnings call, Hershey also mentioned that the top three cocoa producers experienced a 20% increase in supply this season, which offers the company some welcome relief.

Additionally, Hershey shareholders currently earn $5.48 per share in annual dividends. Its yearly payout has also risen for 15 consecutive years, which begins to foster an expectation of annual payout hikes. Thanks to the rising dividend and falling stock price, shareholders earn a dividend yield of 3.4%, far above the S&P 500 average of 1.3%.

Also, that dividend cost the company almost $1.1 billion in 2024. Hershey generated more than $1.9 billion in free cash flow during the same period despite its business challenges, implying that it can afford to maintain the payout and the streak of dividend increases.

Furthermore, investors will not have to pay much of a premium for that income stream. Hershey stock trades at 20 times earnings, well below the five-year average P/E ratio of 25. Considering that and the aforementioned drop in the stock price over the last two years, the company could see a recovery as cocoa shortages continue to abate.

Buy Hershey stock

After cocoa shortages, high prices, and falling sales left a bitter taste in the mouths of investors, Hershey stock might finally find itself in a position for a sweet recovery.

Indeed, conditions look dire due to sky-high cocoa prices. Moreover, revenue levels have begun to suffer as the company failed to fully compensate for lower sales with higher prices in Q1.

Still, the company believes it can register a gain in net sales in 2025, indicating customers remain loyal to its brands. Furthermore, a rising dividend yield and a falling valuation give income investors good reasons to start adding shares.

Such conditions indicate that Hershey stock can recover as investors witness Hershey and the chocolate industry at large moving on from the cocoa shortage.