The COVID-19 pandemic, along with unprecedented stimulus, triggered a massive surge in e-commerce spending. U.S. e-commerce sales jumped 32.4% in 2020 and another 14.2% in 2021. It was the golden age of e-commerce, when online sellers that couldn't turn a profit in normal times were suddenly printing cash.

The thing about golden ages is that they end. Consumer behavior is shifting now that the pandemic is over in the minds of many, and not in a good way for the e-commerce industry. As we learned from Walmart's profit warning on Monday, elevated inflation is forcing consumers to pull back on non-essential items. Inventory is piling up, and a recession looks like a real possibility this year or next.

Unsustainable growth and profits

Shopify (SHOP 0.23%) doesn't sell products directly, but its platform enables sellers of all sizes to quickly put up a storefront online. The pandemic helped Shopify in more ways than one. Brick-and-mortar retailers without much of an online presence had to scramble to embrace e-commerce and keep the lights on, and bored consumers facing restricted store hours and flush with stimulus cash were eager to spend.

Shopify generated $4.61 billion of revenue in 2021, a 57% increase from 2020, and net income was a whopping $718 million. Shopify was not a profitable company before the pandemic. If you look at a chart of the company's net income, it looks like a hockey stick.

SHOP Net Income (Annual) Chart

SHOP Net Income (Annual) data by YCharts

Shopify's growth rate and profits are already diving, but based on recent news, the picture is likely to get a whole lot worse. Revenue grew by 22% in the first quarter, and subscription solutions revenue rose just 8% as far fewer merchants joined the platform. Operating income swung about $200 million lower into negative territory, and the company said that it planned to "reinvest all of our gross profit dollars back into the business to pursue our multiple paths to growth."

Shopify had greatly expanded during the pandemic, betting that the surge in e-commerce demand represented a permanent shift. Even in May when the company reported its results, Shopify was clearly still in investment mode. But that bet, as CEO Tobi Lütke admitted in a memo published on Tuesday, didn't pay off.

E-commerce sales as a percentage of retail sales is reverting to its pre-pandemic trajectory. Shopify is now too big for the current retail environment, so it's cutting around 10% of its workforce. Recruiting, support, and sales are the hardest-hit areas, although the company is eliminating some roles pretty much everywhere. A recession is going to hit exactly the types of businesses that make heavy use of Shopify, so it could be a rough few quarters, or even a rough few years, for the e-commerce company.

Back to earth

Shopify's price-to-sales ratio exceeded 60 at one point in 2020 as investors latched on to the story that booming pandemic-era e-commerce demand was permanent. Shopify was a high-flying stock before the pandemic, but its valuation truly detached from the fundamentals as lockdowns shut down large parts of the economy.

Not only was Shopify trading at a multiple of sales that was high even for a software company, but its sales were temporarily inflated due to the pandemic. It's possible that Shopify will now see its sales decline at some point as the economic outlook worsens, but even if the company can keep the top line growing, that growth will be sluggish at best.

After dropping nearly 16% by Tuesday afternoon following the news of the layoffs, Shopify stock is down about 80% from its all-time high. The price-to-sales ratio has fallen back to roughly eight, which is where it was in 2016. Shopify is unlikely to turn a profit as it contends with weakening demand, but it's hard to argue that the stock is still drastically overpriced. Shopify does genuinely have solid long-term growth prospects tied to the continued expansion of the e-commerce industry.

Shopify made some serious missteps, and investors are paying the price. It may take a very long time for Shopify to exceed its pandemic peak, and earth-shattering returns may not be all that likely. But if you like the long-term story and you can put up with some volatility, now looks like a decent time to buy Shopify stock and hold on for dear life.