Walmart (WMT 0.13%) is doing well in the current volatile selling environment. The retailing giant recently announced surprisingly strong sales trends through the start of 2024, even as consumers became more cautious in their spending patterns. This good news contributed to a strong run for shareholders, with the stock gaining 15% so far this year, compared to a 10% increase in the S&P 500.

Wall Street is excited to see Walmart winning market share in competitive areas like groceries. These successes reflect higher customer satisfaction levels, which are translating into rising shopper traffic. But there's a more important metric to watch when you're judging Walmart as a potential long-term investment.

Why shoppers love Walmart

It was clear from the latest earnings report that shoppers are highly engaged with the world's leading retailer. Comparable-store sales were up 4% through late January, on top of the prior year's 8.3% increase, management said in a late-February press release.

Look closer and you'll see that this growth was driven entirely by higher customer traffic, both in Walmart's stores and on its e-commerce platform. Meanwhile, average spending was flat, in part because the chain cut merchandise prices wherever possible.

That's a good illustration of Walmart using its core competitive advantage to maximum effect. "We're ... excited about building on our momentum as we work to bring prices down for our customers," CEO Doug McMillon explained.

What's missing

There was good news on the earnings front, too. Gross profit margin ticked higher, which is a great sign of efficiency at a time when prices are falling. Walmart got a lift from higher spending on its digital advertising platform, too.

But it's hard not to be disappointed with the chain's sluggish earnings growth. Operating income is only projected to rise by between 4% and 6% this year to just slightly outpace the expected sales growth range of 3% to 4%. Hitting those figures would translate into a roughly 4% operating profit margin this year, which is above Costco's rate but below Target's profitability.

Investors are right to want a bit more from Walmart. The chain is pushing deeper into tech niches like digital advertising and e-commerce, after all. It recently crossed $100 billion in annual e-commerce sales after that segment expanded by 23% year over year. And it's gaining market share in its core retailing niches. If profitability can't expand quickly under those favorable circumstances, then when can shareholders expect to see such a rebound?

Walmart is far from being a struggling business, of course. Management could simply be taking the long view on growth by staying focused on market-share gains today. That's the path that rival Costco has taken, and it has worked extremely well for the warehouse store specialist.

The next steps

Shareholders can still expect better from Walmart's annual earnings potential. That's the surest path toward a stock valuation that reflects the retail chain's impressive growth prospects in attractive tech niches. Right now, Walmart stock is valued at about the same 0.75 times annual sales that investors have seen for years, while Costco's premium is roughly twice that.

It's not reasonable to think Walmart can double its stock valuation. However, investors seeking high returns should watch both customer traffic and operating profit margin for signs that the chain is ready to deliver accelerating growth and higher annual earnings from here.