Walmart (WMT 0.08%) beat analyst expectations with its second-quarter financials for both revenue and earnings. As people returned to shopping in stores, and the retailer benefited from a strong back-to-school season in July, Walmart produced strong comparable-store sales as well.

But one area of disappointment for investors was Walmart's e-commerce business, which saw growth slow considerably.

Walmart boxes coming down a conveyor belt.

Image source: Walmart.

A speed bump for e-commerce

Last year, Walmart grew its digital sales 97% year over year in the second quarter as shoppers stayed home during the early days of the coronavirus pandemic. Walmart benefited from previously laying the groundwork for online grocery ordering and establishing fast shipping capabilities on select products.

But Walmart's tailwind from last year became a headwind for the e-commerce business this year. Online sales grew just 6% year over year. Management was keen to point out it's still more than doubled over the last two years. And while that's better than its biggest competition in e-commerce -- (AMZN -1.54%) -- it's not better by much.

For reference, Amazon's revenue from its online store plus third-party seller services was up 82% in the second quarter versus the same period in 2019. Not only that, but Amazon still managed to grow its online store sales 16% in the second quarter this year.

Indeed, Walmart's online sales growth was heavily reliant on the adoption of online grocery, but now more grocery shopping is moving back to physical stores. To Walmart's credit, however, it grew its share of the grocery market last quarter, despite already holding a dominant position. Additionally, becoming less reliant on online grocery helped improve Walmart's e-commerce operating margin once again in the second quarter.

Where does future growth come from?

Management said it expects to reach $75 billion in global e-commerce sales this year, providing a rare glimpse at how big the business is. But it's unclear if Walmart can capitalize on the success of 2020 to translate it into long-term growth.

Management invested in expanding its fulfillment capacity for online orders for both first-party and third-party sales. It's also opening up fulfillment services to its third-party merchants like Amazon does. Amazon's marketplace drives more sales growth than its first-party retail business these days.

But expanding product selection and improving shipping times is just half of the equation. Walmart needs customers to shop on Amazon shoppers go to Amazon because they have a Prime membership or just because it's the default product search engine. Far fewer online shoppers start their product search on

Walmart has attempted to improve its customer loyalty with membership services, the latest iteration of which is Walmart+. But reports indicate it's struggling to attract and retain members. With online grocery waning as a draw for shoppers to its e-commerce channel, Walmart may struggle to keep growing in fiscal 2023, even after it laps the tough comparable quarters from last year.

While Walmart impressed investors with its strong in-store sales and profits in the second quarter, a big part of the retailer's future is going to be e-commerce. It can't expect strong store traffic growth to fuel sales every quarter.