E-commerce stocks got a boost during the height of the pandemic, but since then many companies specializing in online sales and e-commerce platforms have tumbled. However, what some investors are forgetting is that there's plenty of more room for the online shopping market to grow. 

The most recent data shows that online sales make up just 14.5% of the total retail market in the U.S. right now, which leaves more opportunities for Shopify (SHOP -3.49%) and Amazon (AMZN -0.78%) to expand. Here's why these two e-commerce companies could be good long-term bets for investors. 

Two people sitting on a couch.

Image source: Getty Images.

1. Shopify: The e-commerce platform for everyone

For lots of small businesses, figuring out the best way to get your goods and services online isn't an easy task. 

And that's one of the reasons why Shopify's e-commerce platform is so great.​​ The company makes it easy for businesses of all sizes to set up their shop and then expand with more features and services as they grow. 

The company has grown into an e-commerce powerhouse, with sales increasing 16% in the most recent quarter to $1.3 billion and gross merchandise volume (the dollar amount sold on its platform) popping 11% to $46.9 billion.  

Aside from its recent growth, Shopify is also in good financial shape. The company ended its most recent quarter (reported on July 27) with $3.3 billion in cash and cash equivalents. For a high-growth tech company, that's an impressive amount of cash and it should help Shopify's management keep the company going strong amid any economic uncertainty.

Just as important is the fact that Shopify is still in the early innings of tapping into what the company believes is a $153 billion total addressable market. Considering the company generated just $4.6 billion in sales last year, that means it has plenty of more room to grow. 

Sure, Shopify's share price drop over the past year looks scary. At this point, there aren't many tech stocks that haven't experienced a precipitous plunge over the past year or so. But with Shopify still poised to grab more share of the e-commerce market in the coming years, now could be a good time to add Shopify to your portfolio.

2. Amazon: A clear e-commerce leader

I won't get points for originality for having Amazon on this list, but there's no denying that the company deserves to be listed here. Amazon's massive e-commerce website ($74 billion in North American sales alone in the most recent quarter) is one of the most well-known platforms for buying nearly anything consumers need.

Part of the company's success has no doubt come from its Prime membership. The annual subscription that allows customers to receive free shipping (and a host of other services) keeps many users locked into its ecosystem -- and Prime is as popular as ever. At the end of 2021, there were nearly 160 million Prime members in the U.S., and that number is expected to climb to 176 million by 2025. 

Why does that matter? Because Prime members spend about $1,400 on the e-commerce site every year -- more than double the spending of non-Prime Amazon users.

The great news for investors is that Amazon is not only winning at e-commerce, but also in cloud computing and advertising. The company currently has 34% of the cloud infrastructure market (beating out both Microsoft and Alphabet's Google) and is now a leading player in the digital ad space with nearly 13% market share this year, up from 10% in 2020. 

Its cloud computing business generated $5.7 billion in operating income in the most recent quarter (up 36% year over year) and Amazon's expanding digital advertising business is helping it tap into a massive $299 billion (by 2024) new market.  

With Amazon already an e-commerce leader and the company benefiting in big ways from its other segments as well, holding on to Amazon for years to come will likely be a good idea. 

Ride out current the volatility over the next decade

The broader market, and tech stocks particularly, have been volatile lately. Even during calmer times, taking a buy-and-hold approach to investing is the best strategy for building long-term wealth. 

That sentiment is even more important to follow right now when buying Shopify and Amazon. It's likely their share prices will fluctuate in the near term, but holding on to these stocks for the next decade could end up being a smart way to play the long game in e-commerce.