It's been a rough week so far for Walmart (WMT 1.32%). On Tuesday, shares of the retail giant tumbled 11.4%, its worst single-day drop since 1987. And the shares fell nearly 7% more on Wednesday, tumbling with the overall market.

The consumer staples giant got dinged for missing earnings estimates, and slashing its bottom-line guidance for the rest of the year. While there's no question that a double-digit drop is disappointing, there are a few reasons why the quarter wasn't as bad as it might seem. 

A busy Walmart checkout area.

Image source: Walmart.

An inflationary tale

Like most American businesses, Walmart is struggling with inflationary and supply-chain pressures, and the labor shortage has made it difficult for the company to grow profits. Walmart raised wages last year for front-line employees, but it's still having trouble filling key posts.

The company announced a few weeks ago that it was raising starting salaries for long-haul truckers to as high as $110,000, nearly double the national average, according to Glassdoor. The Wall Street Journal also just reported that the company is struggling to fill store manager roles despite offering a $200,000 salary. Walmart acknowledged that wage pressure was a primary reason that operating margin at Walmart U.S. shrank by nearly a percentage point to 4.6%, or $4.5 billion in operating income.

But even with adjusted earnings per share in the quarter shrinking from $1.69 to $1.30, that performance was still better than it might seem. Most of Walmart's retail peers haven't yet announced earnings, but Amazon (AMZN -1.64%) reported an operating loss of more than $1.5 billion in its North American e-commerce business, a sign that it faced stiff headwinds from inflation and excess capacity after ramping up during the pandemic.

There were also a number of bright spots. Grocery sales increased by double digits at Walmart U.S., partly due to inflation, and Walmart also gained market share in this key category, which makes up a majority of its revenue. The company, known for its "everyday low prices" model, has traditionally been resilient in recessions, and sees them as opportunities to gain market share. In fact, gaining market share is more important to its long-term performance than padding quarterly profits by raising prices, and investors should support a strategy that focuses on market-share gains rather short-term profits.

Sam's Club also continues to deliver blockbuster results with comparable sales up 17%, or 28.1% on a two-year basis. E-commerce sales increased 22% at the club chain and membership income was up 11%. Profits were also down at Sam's, but that top-line growth should pay off over the long run, and it shows Walmart has successfully turned around a business that was long a drag on overall results.

The real reason Walmart stock plunged

While it's not surprising to see a stock fall on an earnings miss and guidance cut, the reason why Walmart dropped by double digits may have more to do with its valuation coming into the report, rather than the results themselves. 

Coming into the first-quarter report, Walmart was actually in positive territory for the year, up 3% for the year, compared to a 14% drop for the S&P 500. After Tuesday's slide, Walmart stock was still outperforming the broad-market index, down 9% for the year. 

Chart showing Walmart's price beating the S&P 500's in 2022, even after Walmart's recent drop.

WMT data by YCharts

With management now calling for adjusted earnings per share to be flat compared to last year at $6.46, Walmart is trading at a forward price-to-earnings (P/E) ratio of about 20, essentially in line with the S&P 500's P/E. Walmart, a slow-growing consumer staples stock, generally trades at a significant discount to the S&P 500, but investors have piled into consumer staples stocks this year to seek refuge from the broader volatility in the market, abandoning growth stocks and tech stocks in the process. Walmart now has roughly the same earnings valuation as Alphabet although the Google parent is growing much faster than Walmart.

Walmart's plunge on Tuesday, therefore, seems like a sign that the pendulum has swung too far as investors try to steel themselves for a potential recession. The stock's reaction shows that growth stocks have gotten too cheap at this point and safe stocks like Walmart are too expensive.

For Walmart itself, fiscal 2023 is shaping up to be a rough year, but the company should emerge from the current volatile environment in a stronger position. However, without the usual discount to the S&P 500's valuation, it will be hard for the stock to outperform in the near future.