Shares of mega-retailers Walmart (WMT 1.00%) and Target (TGT -0.32%) have taken a hit so far in 2022. Both have reported slumping profitability and lowered their annual earnings outlooks, and Wall Street received that news poorly.

But sales trends are still relatively strong for these businesses. And the companies appear to have made the tough inventory decisions needed to set them up for improving results in the upcoming holiday shopping period.

So which of these successful retailers would make a better addition to your portfolio now? Let's take a look.

Walmart is steadier

Both discount chains have been hurt by a swing in consumer demand away from many of the product categories that became more popular in earlier phases of the pandemic. This recent shift was more costly because it occurred in niches that are both high-margin and bulky, like home furnishings, meaning the retailers couldn't simply keep inventory on hand indefinitely. They had to cut prices to get it sold so they could make space for the next season's products.

WMT Operating Margin (TTM) Chart

WMT Operating Margin (TTM) data by YCharts

Walmart is navigating through this challenge much better than Target, which helps explain why many investors see its stock as a less risky bet. Sure, its profitability is lower overall. But the retail titan's huge global sales footprint and its focus on everyday essentials make it less susceptible to large earnings declines.

Target, on the other hand, is expecting its operating margin to fall hard from its prior level of nearly 10% of sales. That's why, if stability is your goal, Walmart might be your stock.

Target has better growth prospects

Look beyond the current earning slump, though, and you'll see signs of potentially stronger growth ahead for Target compared to Walmart. The company gained over $10 billion in new market share during the pandemic, including in areas like home furnishings and beauty products. And customers aren't abandoning it as fears over COVID-19 recede, either.

Target's customer traffic rose 3% in its fiscal second quarter, on top of a 13% spike a year ago. Walmart's U.S. stores saw just a 1% traffic uptick during the period. That gap reflects Target's more attractive growth opportunities ahead in such areas as beauty, food, and household essentials.

Its multichannel selling model is a hit, too, and should continue boosting earnings over time.

Looking ahead

Target's steeper stock price slump this year can be traced right back to management's guidance for weak profitability through the rest of 2022. The chain's bigger exposure to discretionary products means it will be hurt more by consumer demand swings away from these areas in an era of belt-tightening or a wider recession.

Don't let the prospect of a short-term profit hit scare you away from the stock, though. Target has a strong track record for navigating through every type of selling environment. That's why it is one of the few retailers (along with Walmart) on the list of Dividend Aristocrats.

The stock also looks like a relative bargain now that its price-to-sales ratio has dropped to 0.7 -- about the same as Walmart's 0.6. That valuation had been as high as 1.2 times sales within the last year.

Yes, the next few quarters might be tough on Target's earnings. And Walmart is likely to generate steadier sales and profit growth. But Target looks like a better long-term investment today.