Earnings season can be a turbulent period on Wall Street. Some companies impress investors enough to see their shares soar, while others receive a much less enthusiastic -- and sometimes even a downright catastrophic -- response from the market.

E-commerce specialist Shopify (SHOP 4.70%) was in the latter group during the most recent earnings season, and as of this writing, the stock is down by 24% year to date. However, that's nothing for long-term investors to worry about; the company remains a solid long-term pick. Let's find out why.

Shopify's first-quarter results

Shopify's first-quarter earnings looked decent on the surface. The company's revenue of $1.9 billion was up 23% year over year, the same growth rate as its gross merchandise volume, which came in at $60.9 billion for the period. Shopify's gross margin landed at 51.4%, up from the 47.5% reported in the year-ago period. However, Shopify wasn't profitable. It reported a net loss per share of $0.21, compared to a net income of $0.05 in the year-ago period.

Investors ignored the red on Shopify's bottom line for a long time since its top line was growing so fast. But things have changed; long gone are the days of growth at all costs. In this higher-interest-rate environment -- at least higher than they were for most of the previous decade -- investors prefer to put their money in consistently profitable companies. That's a problem for Shopify, whose revenue isn't growing nearly as fast as it once did.

Things will worsen during the second quarter since Shopify expects top-line year-over-year growth in the high teens. The company's valuation only compounds the problem.

SHOP PS Ratio (Forward) Chart

SHOP PS Ratio (Forward) data by YCharts

Even after its recent decline, Shopify's forward price-to-sales (P/S) ratio is nearly 9; the undervalued range is typically under 2. Shopify looks expensive, unquestionably. Are there any good reasons to buy the stock?

What's your investment horizon?

Shopify stock isn't for everyone. Obviously, there is nothing to see for dividend investors. Shopify doesn't pay any. For value investors, the stock probably isn't that attractive either. However, for growth-oriented investors who intend to hold onto the company's shares for at least five years, the company looks like a smart buy, especially considering the 24% drop since the year started. Let's consider three reasons why.

First, Shopify has made some changes and tweaks to its business in recent years that should allow it to achieve consistent profitability much faster than it otherwise would have. Most notably, the company sold off its expensive and low-margin logistics business. Second, Shopify is implementing various initiatives -- especially artificial intelligence (AI)-powered efforts -- that should help improve merchant productivity on its platform.

Last year, the company launched Shopify Magic, a suite of AI-based tools. Helping merchants do things like write product descriptions makes their lives easier which, in turn, attracts more merchants to Shopify's platform. There is plenty more room to grow since the e-commerce industry will expand rapidly through the end of the decade. Third, Shopify benefits from switching costs.

Imagine spending countless hours building a customized online storefront, integrating various functionalities that only Shopify offers thanks to its app store with thousands of options, attracting customers via all the major social media platforms, and building a noticeable brand your target market starts to recognize. After doing all that, migrating to one of Shopify's competitors would be risky.

While it's doable, the operation runs the risk of disrupting the business's day-to-day activities. And starting from scratch is out of the question. Shopify's high switching costs grant it a powerful competitive advantage: In all likelihood, the stock will remain a leader in its niche of the e-commerce field for a while. That's why it is worth at least a bit of premium, in my view. Perhaps it currently trades at too much of a premium, but in five years or more, that won't matter much.

Shopify is well-positioned to deliver market-beating returns over the long run, just like it has since its 2015 IPO. That's why the stock is a smart buy.