McDonald's (MCD 0.17%) has a problem that it thinks fresh-baked doughnuts might help solve. The burger giant just announced an expanded partnership that will bring Krispy Kreme's sweet treats into all of its U.S. locations by late 2026.

It's a huge deal for the doughnut baker, which will soon have access to an extra 14,000 points of sale packed with hungry consumers. It's no surprise that Krispy Kreme's stock shot higher in late March on the expectation that it will sell many more of its glazed and stuffed confections thanks to this deal.

But what does McDonald's get out of the bargain besides some sweet additions to its dessert menu and a potential logistics headache? The short answer is the fast-food giant is hoping to boost its customer traffic, which recently shrank.

Getting people to the Golden Arches

The traffic issues were the main complaint that Wall Street had with McDonald's fourth-quarter update in February. The chain's comparable-store sales rose 9% for the full year, yet it ended 2023 with some of its weakest growth numbers. Comps were up just 4% in the core U.S. market in Q4, down from 8% in the prior quarter. Softer customer traffic was the main culprit.

That's a particularly tough challenge today because McDonald's can't as easily keep hiking prices now that inflation has slowed. This helps explain why the stock is underperforming the market so far this year.

McDonald's path to reaccelerating its sales growth is cloudy, at best. On the conference call with analysts, management said that comps growth might slow down to between 3% and 4% this year, or about half of its recent annual growth pace.

Adding a treat with an established fan base

That's where doughnuts come in. McDonald's frequently gets traffic spikes when it introduces new menu items. Demand was high for Krispy Kreme products at the 160 locations in Kentucky where it tested the partnership. And customers in these locations most likely ordered other products to go along with their doughnuts.

McDonald's needs more than just a temporary pop in visits during the breakfast hours, though. The chain is aiming to boost traffic among its most loyal morning guests, of course, but also wants higher traffic during the afternoon when more occasional visitors drop into its stores. "This partnership is ... a chance to unlock new business opportunities in the breakfast category and throughout the day," McDonald's executive Tariq Hassan said in a press release.

Investors should watch the chain's traffic metric for signs that the partnership is delivering. In the meantime, look for McDonald's to remain active in launching new menu items and promotions. In addition to steady improvements in customer service, these initiatives help convince more fast-food fans to visit its restaurants.

Wall Street doesn't seem excited about McDonald's short-term prospects right now, and the stock has not participated in the market's recent rally. But that could change quickly if the chain can engineer a growth rebound in its core U.S. market.

While management has warned investors that comparable-store sales trends might remain weak compared to the past few years, McDonald's is doing all it can to outperform that lukewarm forecast. Adding Krispy Kreme doughnuts to the menu is just one piece of its wider strategy. It shows the chain is staying flexible in how executives target growth, whether its through promotions of core menu products or the addition of new items. That's how McDonald's has maintained its market leadership through the decades. It's a strategy that's likely to keep the chain on top of the industry going forward, as well.