Retail sales soared last year, notching double-digit gains in every month. Consumers were flush with cash from stimulus checks, so they went shopping. But the U.S. economy looks a lot different today. Decades-high inflation forced consumers to cut back on discretionary purchases, leading to a dramatic deceleration in retail sales.

That economic downturn hit Shopify (SHOP -1.01%) hard. Many investors lost faith in the Canadian e-commerce company as revenue growth slowed and profits evaporated. In fact, Shopify saw its share price plunge 80% from its high, marking its largest loss of value in its history. That means long-term investors now have a rare opportunity to buy this growth stock at a bargain price.

Shopify has a strong competitive position

Shopify has two revenue streams: subscription solutions and merchant solutions. Subscription solutions revenue comes from premium point-of-sales (POS) software and platform fees. The Shopify platform helps retailers manage their businesses across physical and digital stores, including direct-to-consumer websites, online marketplaces like Amazon, and social media like Alphabet's YouTube.

Merchant solutions revenue comes from fees charged for adjacent services, including payment processing, shipping, and financing, among others. Shopify also provides fulfillment services, and that part of its business should expand as its nationwide fulfillment network reaches scale in the coming years.

Shopify's broad portfolio made it popular with small- and medium-sized businesses, but the company is also growing upmarket with Shopify Plus, a commerce platform designed for larger businesses. According to G2 Grid, Shopify and Shopify Plus are the top two e-commerce platforms in terms of market presence. The company enjoys a particularly strong presence in North America. Shopify accounted for 10.3% of online retail sales in the U.S. last year, second only to Amazon.

Shopify sees some near-term headwinds

This year, Shopify struggled with unfavorable foreign exchange rates and high inflation, but management continued to invest in growing the business. As a result, sales slowed while operating expenses rose quickly, and that led to underwhelming financial results. In the third quarter, revenue rose just 22% to $1.4 billion and Shopify posted a non-GAAP (adjusted) loss of $30 million, down from a non-GAAP profit of $103 million in the same quarter last year.

Investors should expect more of the same in the near term. Shopify will probably struggle for as long as the economic downturn persists, and growth may slow further in the event of a recession. Meanwhile, climbing operating costs and capital expenditures will put pressure on cash flow. In fact, management says it will spend about $1 billion on the Shopify Fulfillment Network alone over the next two years.

Those near-term headwinds are likely to make the stock volatile, but patient investors have good reason to be bullish on Shopify in the long run.

The long-term opportunity

Online retail sales worldwide are expected to grow 10% annually to reach $7.4 trillion by 2025, according to eMarketer, while online retail sales in the U.S. will grow at 12% annually to reach $1.5 trillion by 2025. Shopify -- as the leading e-commerce software vendor, and the second-largest e-commerce company in the U.S. -- is already well positioned to capitalize on that. But management also outlined an ambitious growth strategy.

First, the Shopify Fulfillment Network (SFN) will connect a system of warehouses, carrier partners, and last-mile delivery providers across the U.S. to make logistics easier and cheaper for merchants. Ultimately, the SFN will enable merchants to guarantee two-day delivery, and management says that could boost conversion rates by more than 30% in many cases. The SFN will reach scale in late 2023.

Second, Shopify is gaining traction in physical retail. Its point-of-sale systems are now available in 14 countries, and offline gross merchandise volume (GMV) soared 35% in the most recent quarter. Meanwhile, the company is also growing its geographic footprint at a rapid clip, as it recently debuted payment processing in several European markets and launched its financing business in Australia. Shopify Payments is now available in 22 countries, and Shopify Capital is now available in four countries.

Third, Shopify Plus GMV continued to outpace total GMV in the third quarter, due in part to product innovation. Plus merchants now have access to sophisticated tools for marketing, cross-border commerce, and business-to-business commerce. Those tools not only make the platform more compelling, but they also expand Shopify's addressable market. For instance, U.S. B2B e-commerce sales will total $3 trillion in 2027, according to Forrester Research.

Currently, shares trade at 8.7 times sales -- a bargain compared to the three-year average of 36.3 times sales -- and a reasonable price to pay for the potential upside Shopify offers. That's why this stock is a screaming buy in November.