Walmart (WMT 0.26%) stock is traditionally seen as a safe investment during recessions. The retailing titan, which has navigated through dozens of demand slumps in the past few decades, tends to do well when consumers are focused on staple products and looking to stretch their budgets.

But many investors are still avoiding the stock today, especially after the chain reduced its earnings outlook. Heading into what could be a difficult holiday shopping season, Walmart seems to have inventory challenges that could harm profitability into 2023.

With that big picture in mind, let's look at whether the retailer is a good buy candidate right now.

The latest trends

Investors have mixed expectations for the business into early 2023. Walmart's sales trends are holding steady, with customer traffic rising 1% in the most recent quarter on top of huge gains over the last two years. Target is growing faster, but Walmart remains a leader in the massive retailing space, even as consumers make big changes to their shopping patterns.

The earnings outlook isn't as bright. Walmart recently affirmed a weak profit forecast thanks to several headwinds, including oversupply of home furnishings inventory, soaring costs, and foreign exchange rate shifts.

Operating income is down 7% through the first half of fiscal 2023 and will likely fall by as much as 11%, according to management's mid-August forecast. Free cash flow has been hit even harder thanks to the combination of higher spending and slower sales growth.

Reasons to buy

Walmart looks like a relatively safe option for investors seeking lower-risk options in a volatile market. Management is already pivoting merchandising strategies toward more essentials ahead of holiday shopping spikes in the fall and winter, and so the worst of its price cuts might be behind the business.

Its margins aren't shrinking as fast as peers like Target, either, in part because of Walmart's huge presence in stable areas like grocery and health. While its electronics and home products sales are down, that diversity is helping it continue growing while companies like Best Buy report declines.

Its multichannel selling posture, meanwhile, is keeping overall sales rising even as e-commerce specialists like Wayfair post big sales slumps. Here is yet another way in which Walmart's size gives it a huge competitive advantage. A key factor in a recession-resistant business is that revenue steadily rises through many types of selling environments.

Is it a deal?

Walmart's stock price has dropped, making it a more appealing long-term holding. Investors are paying 0.6 times annual sales for the company today, compared to 0.7 times for Target and roughly 1 times sales for Costco.

Sure, Walmart isn't as profitable as Target. And it doesn't benefit from the massive stream of membership fee income that keeps Costco's earnings stable through economic swings. But it's a staple shopping destination for millions of consumers, who continue to visit its stores through recessions. Walmart's financial strength makes it one of the few companies that can continue investing in growth through any downturn, too.

Those factors, plus the stock's dividend that today yields nearly 2%, make it an attractive option for many investors. Shares might not surge as high during the next economic upswing. But Walmart's stock is also unlikely to crash at a time when the wider market is falling.