As the COVID-19 coronavirus outbreak knocked the market into bear territory, Walmart (WMT 1.00%) shares resisted. The stock has slipped only 3.8% so far this year, compared with a 31% loss for the S&P 500. And while many retailers of nonessential goods have temporarily closed their doors, Walmart's grocery and household offerings have kept it in business during the crisis, in physical stores and online. The company this week even announced the creation of 150,000 new jobs.

A green shopping bag overflowing with grapes and a loaf of bread sits atop an open computer with a blurred image of shopping aisles in the background.

Image source: Getty Images.

As with many stocks, I'm not expecting great gains in the near term due to the weight of the coronavirus outbreak on the market. But here are three reasons Walmart is a solid long-term investment:

1. Grocery and e-commerce strength

Though weakness in toys and video games hurt Walmart's fourth-quarter earnings, the strength in groceries is a more important point. Food makes up 56% of revenue at Walmart's U.S. stores, according to the company's annual report, so positive news out of this business is significant for the company as a whole.

Add to that a second big plus: growth in the company's e-commerce platform, which goes hand-in-hand with groceries as more and more consumers shop online (more about that below). Walmart said its U.S. e-commerce sales grew 37% in fiscal 2020, and grocery pickup and delivery added to fourth-quarter e-commerce gains. The company earlier this month began the rollout of its combined grocery and general merchandise app. The Walmart Grocery app becoming part of the Walmart app will make it easier for consumers to order a wide variety of products at once.

2. A new way to shop?

Before the coronavirus, shopping for groceries online already had been gaining momentum. According to eMarketer, groceries are the fastest-growing e-commerce product category in the U.S. and will reach $38 billion by 2023 from almost $20 billion last year. Since the coronavirus pandemic escalated, gains in online grocery sales also escalated as consumers stayed home to avoid infection risk. Digital Commerce 360, citing Rakuten Intelligence, reported the dollar value of online grocery orders from March 12 through March 15 surged 210%, and the number of orders climbed 151% year over year. 

Will this continue once the disease is contained? At this level, the answer is probably no. But it's likely some shoppers who used to buy groceries exclusively in brick-and-mortar stores may be won over by the convenience of online shopping and continue on a regular basis. This could result in a higher growth rate than predicted before the pandemic. And this bodes well for Walmart due to its emphasis on e-commerce expansion.

3. Dividends

We can rely on strong dividend stocks even in a market downturn. Without knowing how long the current bear market will last, adding a few dividend stocks to our portfolios now is a good way to assure at least that much income. Walmart has increased its annual dividend every year since it started paying it in 1974. The company paid out about 41% of its free cash flow as dividends over the past year. Though Walmart's free cash flow has declined from a peak reached in December 2016 to the current level of $14.6 billion, it has made its way progressively higher over the past 20 years with only a few dips. That gives us reason to be optimistic about Walmart's ability to continue its dividend policy.