There are advantages to choosing stocks that you can hold forever. First, it forces you to look past a company's recent growth and stock performance and look at the deeper qualities that will keep the business humming along for decades.

When you own a company that can grow for a long time, it means you can park your money in the stock and let it grow in value for potentially decades without interrupting your returns by selling and paying taxes on capital gains.

Shopify (SHOP -2.37%) and Etsy (ETSY 0.49%) are two market leaders that fit the bill. E-commerce isn't going to stop growing just because of temporary setbacks in the broader economic environment. Here's why these two companies are well positioned to deliver returns to long-term investors.

1. Shopify

The e-commerce market was estimated to total more than $5 trillion last year, according to eMarketer. That is a huge opportunity for small businesses that can leverage social media to market their brands and instantly connect with the millions of buyers.

With a Shopify Plus subscription, businesses get access to a powerful selling platform that manages just about every aspect of their online storefront, including marketing, payments, and shipping. Shopify has become a go-to solution for small and large companies alike. A key reason is that its software expertise kept it ahead of the competition and it introduced new services to expand its platform, including a point-of-sale solution for in-store checkouts.

Despite headwinds like pandemic disruptions, macroeconomic challenges, and resulting slowing growth, Shopify's revenue and gross merchandise volume more than tripled since 2019, and the acceleration of revenue growth at the end of 2022 is a good indicator of what's likely to come. 

Shopify stands out for its intuitive solution for bridging the learning gap of how to set up an online business. But with e-commerce and online payments representing such a massive opportunity, there will be an endless number of new threats, including numerous shipping label services and competing e-commerce software providers. But Shopify has its own advantages to protect its competitive position.

For example, Shopify's Shop app is collecting valuable customer purchase data, where it can recommend new products to customers from across the company's merchant network. With over 100 million shoppers registered on the Shop app, this is an important tool to add value for merchants. 

It also continues to roll out several new features every year to make its platform a must-have for small business owners, including Shopify Tax to help with tax compliance for U.S. merchants, and Shopify Audience, a marketing tool that uses machine learning to help merchants find high-intent buyers for their products.

Meanwhile, the stock is trading at its lowest valuation since the company's IPO. That reflects the recent deceleration in growth: Gross merchandise volume increased by 12% last year compared to 47% in 2019, but Shopify's slower rate of growth during a perfect storm of high inflation and supply shortages hurting retailers is not a reason to avoid the stock. 

Shopify reported a revenue increase of 26% year over year in the fourth quarter, its fastest rate of growth since the fourth quarter of 2021. Obviously, we don't want to buy a stock for one quarter's worth of performance, but the acceleration suggests the company is perhaps on a stronger footing than the market is giving it credit for. It certainly indicates that Shopify is still a go-to solutions provider for online merchants, which further bolsters the long-term investment case for the stock.

2. Etsy

Another beaten-down leader in e-commerce that is ripe for a rebound is Etsy. Etsy carved out its niche by focusing on providing a marketplace for special, handmade merchandise. It ended 2022 with around 95 million active buyers and nearly 7.5 million active sellers. But investors shouldn't assume that its niche focus means a low ceiling of opportunity.

Etsy previously estimated the market opportunity for special goods at approximately $100 billion. Its gross merchandise sales (GMS), which is the value of all the goods sold on its marketplace, came to $13.3 billion in 2022, including the extra GMS from recent acquisitions. 

Etsy's GMS has more than doubled since 2019. The market for boutique goods is large enough for Etsy to grow for many years, but investors soured on the stock over a small decline in GMS in the fourth quarter. But while that might look concerning, Etsy isn't done growing by a long shot.

Another reason to like the stock is management's focus on identifying other niche marketplace businesses that it can acquire to stretch the company's growth potential even further.

For example, the secondhand clothing market is also a very large opportunity, and management might have found a gem with the 2021 acquisition of Depop. Depop ended 2022 with 30 million registered users, and management believes it's very early days for the resale clothing opportunity -- a market estimated at $182 billion, according to GlobalData.  

The weak sales trends in 2022 are not long-term trends, which is why investors shouldn't be afraid to buy Etsy stock while it's down. The stock's forward price-to-earnings ratio of 31 is a reasonable price to pay for a relatively small e-commerce company with a long runway of growth ahead.