Shares of e-commerce software company Shopify (SHOP 1.11%) were up 124.4% in 2023, according to data provided by S&P Global Market Intelligence. This handily outpaced the 24% gain for the S&P 500.

Distilling an entire year into a succinct narrative to explain Shopify's outperformance is challenging. However, the chart below shows that some of biggest gains for Shopify stock came in May and November. And this helps investors narrow things down to just the most relevant news.

SHOP Chart

SHOP data by YCharts

On May 4, Shopify announced that it was selling its logistics business. This was a monumental shift considering it had acquired logistics company Deliverr exactly one year prior. Logistics was quite unprofitable for Shopify so the market was glad to see it gone.

On Nov. 2, Shopify announced financial results for the third quarter of 2023. And the company's improvements to profitability were impossible to overlook. Its Q3 gross margin was 52.6% compared with a gross margin of 48.5% in the prior-year period. And its quarterly free cash flow of $276 million was an all-time high.

Diving into logistics hurt Shopify's profits and the market didn't like it. By contrast, abruptly pivoting away from this decision improved the company's financials. And it's why the stock had such an amazing year in 2023.

What is Shopify doing?

Shopify provides merchants with a platform for building an e-commerce site, accepting payments, and more. The company began building a logistics network because it believed it would stimulate more e-commerce growth. There was never the illusion that it was going to be high-margin.

However, in explaining the rationale to get out of logistics, Shopify co-founder and CEO Tobi Lütke said that logistics were a distraction from its main objectives. Nevertheless, the company went down that road to bring a technological touch to a traditionally non-tech space. Lütke said he believes it accomplished that goal and that's why it made sense to sell the business to Flexport.

In other words, Shopify spent time, money, and energy building a logistics platform that would work to support its growth. By partnering with Flexport, it can now enjoy the benefits without needing to provide the operational oversight.

Shopify still has upside

During its investor-day presentation in December, Shopify's management emphasized just how large its total addressable market is compared to present-day business. Management said that its opportunity was "just" $45 billion in 2015. But thanks to new products and services, its opportunity is now a stunning $849 billion.

Therefore, Shopify believes it's only captured 1% of its global opportunity, which points to substantial long-term upside yet to come.

Shopify shareholders certainly hope this is true. The company's growth has slowed considerably in recent years, which is concerning to some. But it's still guiding for double-digit growth in the upcoming fourth quarter. And the holiday shopping season started strong with 24% year-over-year sales growth for its merchants on the weekend of Black Friday.

Therefore, Shopify stock is already up big. But business is still growing and management has large ambitions, which should be encouraging to investors.