Walmart (NYSE:WMT) disappointed investors when it reported e-commerce sales growth of just 23% in the fourth quarter. The company had previously been growing online sales over 50% year over year, and it has guided for 40% U.S. e-commerce sales growth in fiscal 2019.

Management said the fourth-quarter slowdown was due to lapping the 2016 acquisition of as well as unforeseen operational challenges related to keeping everyday items in stock during the high-demand fourth quarter.

Meanwhile, the company continues to take a loss on its online sales. Initiatives such as free two-day shipping to match's (NASDAQ:AMZN) Prime and expanding its online grocery order and pickup system have increased the cost of goods sold online relative to in-store sales.

Analysts asked management about gross margin and profitability on multiple occasions during the company's earnings call. But if Walmart really wants to compete and get to 40% e-commerce sales growth this year, it can't worry about profitability right now.

Close up of cardboard box with printed on it.

Image source: Walmart.

Amazon faced similar challenges

It's important to note that Amazon isn't immune to the operational challenges Walmart saw last quarter. Just a couple of years ago, investors were worried that Amazon's fulfillment costs were ballooning as it struggled to find space for third-party merchants' inventory in its warehouses.

Amazon went on to invest heavily in further building out its fulfillment network. In the two years since, Amazon's fulfillment center square footage increased about 70%.

And the results have paid off. Amazon's first-party online sales increased 20% year over year in the fourth quarter, while third-party seller services -- a good indicator of third-party sales growth -- increased 41%. Overall, gross merchandise volume growth on Amazon very likely outpaced Walmart's in the fourth quarter despite its massive size.

Will Walmart step up like Amazon?

Even when it faced challenges, Amazon showed it was willing to sacrifice profits to keep sales. Keeping the sale, even at a loss to the company, probably resulted in more repeat customers than if Amazon opted to let some items go out of stock, as Walmart did last quarter.

Walmart's inability to keep sales, either because of fiscal conservatism or being completely unprepared operationally, has already cost it long term at least to some minor degree. Imagine going to buy something on and finding it's not available for shipping. How likely are you to go back the next time you need that item?

Spending more, and losing more, now gives Walmart a good chance of competing online with Amazon, which is quickly moving into groceries -- Walmart's bread and butter.

A Walmart associate loading groceries and other items into a customer's car.

Image source: Walmart.

But commentary from Walmart's management indicates hesitancy to take more losses. The company outlined plans to shift marketing dollars from to, as its dollars are more efficient in marketing the latter. Why not spend on both brands?

Regarding the overall loss for e-commerce operations, CEO Doug McMillon said "It's possible we may choose to lose a little more in e-commerce this year than we did last year, but generally speaking, we think it'd be about the same level of losses." He did leave some wiggle room by providing lots of caveats, but overall his comment indicates there are no plans to substantially increase spending to fix the operational challenges it faced in the fourth quarter and prevent them from happening again.

That said, there are some big areas of investment for Walmart this year. It's going to integrate Jet's Smart Cart technology, which offers customers better prices for buying more items at the same time, opting for no returns, or using a debit card over a credit card.

Walmart will also add about 1,000 new stores to its online grocery order and pickup program (a doubling of locations), which management believes will drive it back to 40% online sales growth for the full year. One has to question, however, how an increase in online grocery sales will affect Walmart's in-store sales as it keeps growing.

I'm skeptical Walmart will be able to meet its 40% sales growth outlook if it pulls back on marketing and doesn't invest heavily in improving its fulfillment operations. That's basically the exact opposite of what Amazon's done, and if anyone's worth copying in online retail, it's Amazon.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Adam Levy owns shares of Amazon. The Motley Fool owns shares of and recommends Amazon. The Motley Fool has a disclosure policy.