Shareholders in Hershey (HSY -1.36%) are hoping for sweeter days ahead following a frustrating 2024. Underwhelming sales by the confectioner have pressured the stock, which is down about 12% over the past year and currently near a 52-week low.

Despite some bitter headline numbers, there are several reasons now could be a great time to pick up shares in a high-quality company that maintains solid fundamentals. Let's look at two of them.

1. It's ready to move past temporary headwinds

Hershey, with its signature chocolate, is a globally recognized consumer goods pioneer with a legacy spanning more than 125 years. What's less widely known is that the company also controls a broader portfolio of several other iconic chocolate and candy brands such as Reese's, KitKat, Jolly Rancher, and Twizzlers.

In recent years, Hershey has also made progress expanding into salty snacks by acquiring brands like SkinnyPop popcorn and Dot's Pretzels, which have emerged as key growth catalysts.

Ultimately, this diversified portfolio and leadership across several categories highlight the attraction of the stock. Beyond any near-term weakness, there is some confidence the company has plenty of room to grow worldwide with a positive long-term outlook.

Happy-looking person holding a chocolate bar.

Image source: Getty Images.

The challenges Hershey faced in 2024 reflected some macroeconomic headwinds for the broader packaged foods industry. Management has cited customers' pulling back on discretionary spending, a theme echoed by many other consumer staples companies. Retail shoppers have been more budget conscious as a response to higher pricing in recent years.

Hershey has been particularly exposed to historically high cocoa prices as a key raw-material cost, translating directly into a lower operating margin.

In the third quarter (ended Sept. 29), sales fell 1.4% while adjusted earnings per share (EPS) were 10% lower year over year.

These trends are disappointing, but a key takeaway is the general sense of stability in the overall business. The company is guiding for full-year 2024 sales that are flat relative to 2023, with a modest 6% decline in adjusted EPS.

Nevertheless, the company is optimistic for a return to growth alongside an expectation that cocoa pricing may normalize lower ahead of a projected global surplus in 2025. Efforts to improve supply chains and generate financial efficiencies mean Hershey could emerge stronger.

If the company gets back on track with improving operating and financial indicators over the next few quarters, it could mark the start of a sustained rally in its stock price.

2. The stock is historically inexpensive

What I like about Hershey stock is its compelling valuation, currently trading at 19 times trailing-12-month EPS as a price-to-earnings ratio (P/E), well below its 10-year average earnings multiple closer to 27. While some of that discount can be warranted given the weaker results in the past year, there's a case to be made that Hershey is simply undervalued, and investors could be getting a bargain assuming its long-term potential is still intact.

That line of thinking likely played a role in the move by snacks industry peer Mondelez International (MDLZ -0.03%), owner of brands like Oreo cookies and Sour Patch Kids candy, to approach Hershey in 2024 for a potential takeover. Despite no official announcement, a report by CNBC suggested the board of directors rejected the offer for being too low.

Ultimately, Hershey remains an attractive acquisition target for various consumer staples companies seeking to expand into confections or snacks. The possibility of a better deal down the line is not necessarily a reason by itself to buy the stock. But it at least limits the downside risk with the understanding that multiple suitors could step in for an acquisition at a premium price.

HSY PE Ratio Chart

HSY PE ratio, data by YCharts.

Final thoughts

Hershey still has a lot to prove in what will be a crucial 2025. Recognizing the lingering uncertainties, I believe the recent market volatility presents a great opportunity to invest in a beaten-down industry leader well positioned to reward shareholders. Keep in mind that the stock yields 3.3% through a quarterly dividend, which can be great as part of a diversified portfolio.