Since its initial public offering in May 2015, Shopify (SHOP 2.95%) stock has been a fantastic investment, returning 2,000% in that roughly eight-and-a-half-year stretch. This gain crushes the Nasdaq Composite's performance by a wide margin. However, it's been an extremely volatile ride. Shares are currently 68% below their all-time high from November 2021 -- and this is despite strong growth of the business.

So what should investors think of this top e-commerce stock now? Is it a buy, sell, or hold? Let's take a closer look.

A leading competitive position 

For those who aren't familiar, Shopify offers an eponymous tech platform that provides various tools allowing merchants to easily set up shop to start selling products online. Offerings include payment solutions, point-of-sale hardware products, marketing tools, and a third-party developer ecosystem with different apps. Shopify has caught on with customers so well that it holds a leading 28% share of the industry for e-commerce platforms in the U.S. 

Despite macro headwinds and worries about a possible recession, Shopify continues to report impressive gains. Revenue and gross merchandise sales jumped 31% and 17%, respectively, in the latest quarter (Q2 2023, ended June 30). To be clear, these gains are a slowdown from previous years, but investors should still be encouraged given the uncertain economic environment. In the current quarter, management expects revenue to rise by a "low-twenties percentage rate." 

Shareholders will also be happy to see positive free cash flow in the quarter, with improvements coming. "We expect free cash flow for Q3 to be higher than the entire first half of the year," CFO Jeff Hoffmeister said on the Q2 2023 earnings call. Shopify appears to be on its way to becoming a sustainably profitable business. 

Zooming out a bit, investors should appreciate that Shopify has developed an economic moat, which is a key characteristic that Warren Buffett looks for when identifying companies to invest in. In Shopify's case, it benefits from switching costs. 

Put yourself in the shoes of a typical Shopify customer. You might be using numerous products and services that the company offers. Basically, the tech is ingrained in your operations, almost like a mission-critical service provider. 

Because it would be such a huge pain to switch to a Shopify competitor -- say, WooCommerce or Wix -- these merchants are more inclined to stay put. And this stickiness is an advantage because Shopify can use these existing customer relationships to drive greater engagement and revenue. 

Looking ahead, it's easy to get excited about Shopify's long-term opportunity. Online sales still represent less than 20% of total retail spending in the U.S., creating a sizable growth runway. 

And with the rise of artificial intelligence (AI), Shopify can find even more ways to add value for its customers. "We recognize the immense potential of AI to transform the consumer landscape and commerce more broadly," President Harley Finkelstein said in the Q2 earnings call. "And we are committed to harnessing its power to help our merchants succeed." 

The investor's perspective 

It doesn't take a long time to come up with valid reasons for why prospective investors would want to buy shares in Shopify. For starters, the growth even in an uncertain economic time has been impressive. And the long-term outlook remains robust. 

Plus, with the stock down so much from its peak price, the valuation is much more attractive than what it used to be. Shares trade at a price-to-sales ratio of 11, which is significantly below the historical average of 23. This means now could be a great time to buy. 

Existing shareholders could view things the same way. Shopify's growth potential and its current valuation could be enough to entice them to stay on board. On the other hand, I can also understand the argument for why it's time to sell the stock. Shares have skyrocketed 108% in the past 12 months and 56% this year. Perhaps it's a good idea to take some profits off the table. 

Whatever your point of view, it's best to thoroughly think things through before making a decision.