Investors don't know what to make of Walmart Inc. (WMT 0.18%) these days. While the stock nearly doubled over a two-year period starting in October 2015, shares of the world's largest retailer fell off a cliff in February after the company said e-commerce growth had suddenly slowed. 

Since then, the stock has traded sideways and is still down 11% year-to-date, while the S&P 500 is up 6% and rivals like Amazon (AMZN 0.81%) and Target have both surged. Let's take a look at where Walmart is today, and then consider the buy/sell case.

A Walmart employee stocks shelves with detergent.

Image source: Walmart.

A retailer in flux

Pressured by the rise of e-commerce and the threat posed by Amazon, Walmart has had to significantly change its business model in recent years. Gone is the old land-grab strategy that led the company to spend billions opening dozens of supercenters across the U.S. each year; now the company is focused on e-commerce, investing in its own platform and spending billions on acquisitions like Jet.com and Flipkart. It's also invested in its current store base, raising employee wages, and improving training in order to do things like eliminate out-of-stockages, clean up stores, and speed up checkout lines. 

Profit growth has slowed as a result, though analysts see earnings per share improving from $4.42 to $4.81 this year with the help of the new tax reform law. However, those investments have paid off on the top line: Comparable sales in the U.S. have grown for 15 straight quarters, and the company is also more competitive and in a better position to face off against Amazon. E-commerce sales growth has also been strong, up 44% last year and projected to grow another 40% this year.

The buy case

Walmart is the world's largest retailer and also the world's largest company by sales. That size gives it a considerable advantage in the form of economies of scale, as none of its peers can match its buying power. Since Walmart is the biggest customer for many of its suppliers, when it talks, they listen -- and the company has looked to its suppliers for savings in recent years as it aims to meet the challenges of the e-commerce era.  

For income investors, Walmart is also a Dividend Aristocrat, having raised its dividend every year for 45 years in a row. It now offers a yield of 2.5%.

However, Walmart's fate will rest on its ability to build out a viable e-commerce and omnichannel business, and investors showed their sensitivity to its e-commerce growth after e-commerce growth slowed to 23% in the fourth quarter ended this January.  Walmart has been aggressive here, taking over not only Jet.com and Flipkart but also smaller brands like Bonobos, Modcloth, Shoebuy, and Moosejaw. Walmart bought Jet in part to put its founder, e-commerce entrepreneur Marc Lore, in charge of the parent company's e-commerce operations. In that position, Lore has made free two-day shipping available across the U.S. for orders of $35 or more, and experimented with things like pick-up towers and employees delivering packages on their way home.

Walmart has also doubled down on grocery pickup, rapidly expanding the number of pickup stations in stores to an expected 2,000 this year. That strategy has been key in driving the company's e-commerce growth and maintaining its market leadership in grocery, which contributes more than half of its revenue. While the supermarket industry is getting more competitive, especially with Amazon's acquisition of Whole Foods, Walmart's pickup solution appears to be a smart way to drive growth and control costs, and the program seems to be resonating with customers.

Those moves have resulted in steady growth, and the company looks set to continue in that direction with the acquisition of Flipkart. Abroad, Walmart has been partnering with local e-commerce companies like JD.com and Rakuten in Japan, which has proven to be a smart strategy so far. In the U.K., it also sold its Asda subsidiary to Sainsbury.

Reasons to sell

Despite those moves, Walmart is still the biggest target in Amazon's path, and the e-commerce giant just put up another monster quarter with 39% sales growth. Amazon keeps making its Prime membership program more appealing, and as technologies like drones and driverless cars become more advanced and prevalent delivery will become even cheaper and convenient, making online shopping even more attractive.

In other words, in the future Walmart's stores could become an albatross, or simply unnecessary, as more Americans shop from the convenience of their homes and phones. Walmart could follow the lead of department stores like Macy's, which have been forced to close down stores despite solid profits.

Walmart's valuation also warrants examination. The stock surged in 2016 and 2017 as its turnaround strategy began to deliver results, but many of the expected gains from e-commerce growth may already be priced in. The stock trades at a P/E of 19.4, a reasonable valuation but not one that makes the stock a buy on price alone, as it's only expected to deliver moderate growth over the coming years.

Is it a buy?

Whether or not you'd want to buy Walmart will depend on the kind of investor you are. The stock won't deliver the kind of blockbuster growth that Amazon or other tech stocks have, but for investors looking for defensive, dividend-paying stocks, Walmart looks like a solid bet. The company has proven itself to be a reliable dividend payer, and because of its reputation for low prices it tends to outperform the market during recessions, as its business is more resilient than most. That's good news in case another bear market hits. Meanwhile, store-based sales are still growing despite all the attention paid to e-commerce, and the stock gives investors exposure to growth markets internationally and through online sales, as the company isn't sitting still as the retail landscape changes.

If you're looking for a dividend payer that can deliver long-term steady growth, Walmart looks like a good choice.