E-commerce giant Shopify (SHOP 1.11%) surprised investors and analysts earlier this year when it decided to ditch its logistics business even though management had repeatedly emphasized its importance for the company's future. However, the market liked the move, and Shopify's third-quarter financial results explain why.

Let's look into the tech company's latest quarterly update to find out how this move is paying off for Shopify and why the stock remains an excellent option for long-term investors.

Margins matter, and so does profitability

Shopify sought to steal a page from Amazon's playbook by building a comprehensive fulfillment network. The benefits of doing so are straightforward. Offering fast delivery options on thousands of items is a significant selling point for shoppers and can lead to them spending more money (and doing so more often) than they otherwise would.

However, Amazon spent a small fortune building its fulfillment network. Shopify's attempts to replicate this feat were weighing on the company's margins and its bottom line. Now that it has given up on this goal, the tech giant's performance is improving. In the third quarter, Shopify's revenue of $1.7 billion increased by 25% year over year, partly due to the company's decision to increase its prices earlier this year.

The company's gross profit soared by 36% year over year to $901 million. On the bottom line, Shopify's net loss per share of $0.12 in the third quarter of 2023 turned into net earnings per share of $0.55. The company's failure to post consistent profits has been one of the major arguments against it, but it now looks more likely than ever that Shopify will start being profitable regularly.

Focus on the long term

Shopify has recently implemented several key initiatives that should help improve merchants' experience on its platform and lead to stronger revenue growth. The first is the company's partnership with Amazon, via the Buy with Prime App, allowing Shopify merchants to offer Amazon Prime benefits on their Shopify stores. These benefits include fast delivery options on thousands of items. Amazon has reported that Buy with Prime has been shown to increase shopper conversion by an average of 25%.

Second, Shopify announced a set of artificial intelligence-powered tools to simplify the lives of its merchants, generating things from blog posts to automatic product descriptions. These are just a continuation of what Shopify has done for a long time: introduce new ways to improve its business for the benefit of online merchants.

That's why Shopify is one of the most prominent e-commerce companies that provides all the tools people need to start and run a successful online storefront. That's also why Shopify continues to grow. The company's solid top-line increase in the third quarter was partly driven by more merchants joining the platform. As Shopify's offerings improve, the company's economic moat will only strengthen.

Shopify also benefits from high switching costs. Considering the time and effort it takes to build an online store with Shopify and the time and effort it takes to attract customers, merchants can't just easily close up shop and opt to restart from scratch with one of Shopify's competitors. There is the option for customers to migrate their stores from one provider to another, but even that isn't the easiest thing in the world.

It is much simpler for business owners to stay where they are unless the benefits of going elsewhere are worth the high costs. That's why Shopify has generally gained -- and not lost -- merchants. Meanwhile, there remains a vast opportunity in e-commerce. The sector is projected to continue growing rapidly. Shopify looks well positioned to take advantage.

And with the company's recent changes, the business is stronger than ever. Shopify remains one of the top e-commerce stocks to buy and hold.