Market crashes are an unavoidable part of investing. Since 1968, the S&P 500 has dropped more than 20% on nine different occasions. That means bear markets happen fairly frequently, about once every four years. But here's the secret: Bull markets tend to rise higher and run longer.

That being said, it's impossible to predict the next market crash -- not even the smartest analyst knows the future. That's why it's best to buy high-quality stocks you can hold for the long term, whether the market is going up or going down. I think Shopify (SHOP -2.37%) fits that bill. Here's why.

Person lounging on couch at home holds a credit card in one hand while browsing on a laptop.

Image source: Getty Images

Big market opportunity

Shopify's mission is to make commerce better for everyone. To that end, its platform helps merchants manage their businesses across multiple sales channels, including digital storefronts, online marketplaces, and physical retail locations. It also allows them to process orders, track inventory, and access analytics. In short, Shopify democratizes commerce.

This business model fits perfectly with the global push toward digitization. Each year, as more consumers shop online, e-commerce becomes a larger percentage of total retail sales. And no market crash is going to change that trend. In fact, the last bear market (sparked by the pandemic) actually accelerated the shift toward e-commerce.

According to management, this puts Shopify in front of a $153 billion market opportunity. And that figure should only get bigger in the years ahead.

Smart growth strategy

Shopify ranks third on Fast Company's list of the world's most innovative businesses. The Canadian commerce giant earned this recognition for its quick reaction to the pandemic. Specifically, it provided a lifeline for sellers during a difficult time, helping them "launch online operations overnight." But this wasn't a new development -- Shopify has consistently executed on a merchant-first growth strategy.

Most notably, Shopify helps sellers differentiate their brands. Rather than taking a marketplace approach like Amazon, Shopify's software allows sellers to build stand-alone storefronts, integrate with social platforms, and develop lasting relationships with buyers.

Shopify also provides a range of merchant services, like payment processing, discounted shipping, and financing. And it's currently building a robot-powered network of warehouses across the United States. Once complete, Shopify's fulfillment services will simplify delivery and supply chain management for sellers, while improving the experience for buyers.

To summarize, Shopify's merchant-first approached has helped its business grow quickly. Case in point: Between 2016 and 2020, the number of Shopify-powered businesses surged from 377,500 to 1.7 million -- that's a 47% compound annual growth rate.

Strong past performance

Broadly speaking, Shopify generates revenue in two different ways: software subscriptions and merchant solutions (e.g. payment processing and shipping). Notably, both segments have grown at an impressive pace.

Last year, subscription sales jumped 41% to $909 million, as sellers flocked to Shopify's platform during the pandemic. That influx of sellers also drove strong growth in merchant solutions -- but in this case, that growth was compound by increasing adoption of Shopify Payments, Shopify Shipping, and Shopify Capital. That caused merchant solutions revenue to surge 116% to $2.0 billion.

But Shopify's track record of outperformance started long before last year. The company has consistently delivered strong top-line growth.

Metric

2016

Q1 2021 (TTM)

CAGR

Revenue

$389.3 million

$3.4 billion

67%

Data source: Shopify SEC filings. TTM = trailing-12-months. CAGR = compound annual growth rate.

Looking ahead, tailwinds from the digital transformation should keep the e-commerce industry growing. And Shopify's merchant-first philosophy should help the company maintain its momentum. That's why I plan to own this stock for the long term, whether the market is rising or falling.