After a surge in 2023 that lasted through July, the S&P 500 has retreated from its year-to-date highs. Bullish investor enthusiasm coming into the new year has deflated as interest rates keep rising and many retailers' updates haven't been pretty.

The good news is that many stocks have kept most of their gains, and the pullback may offer investors better entry points. Shopify (SHOP -2.25%) stock was up more than 100% year to date in July, but that gain has shrunk to about 70%.

Even at the current price, shares trade at nearly 12 times trailing-12-month sales -- a premium valuation. Should you be willing to pay that premium, or is this stock too expensive?

What's so great about Shopify?

Shopify provides turnkey e-commerce solutions for small and medium-sized businesses. It's the easy way to get a company online, and Shopify provides everything a merchant needs to succeed. It has millions of customers that pay monthly subscription fees, and with new ones always signing up, it operates a growing platform. You won't see Shopify's name prominently on the websites it powers, so you may not realize that it's one of the largest e-commerce companies in the world based on the gross merchandise volume it processes for its clients.

Shopify was an investor favorite even prior to the pandemic, but its stock shot sky-high early in the crisis when small businesses realized they had to migrate online to stay alive. Like many retailers and analysts, Shopify thought the elevated e-commerce growth spurred by the pandemic was here to stay, and it built out its business to meet skyrocketing demand. However, e-commerce didn't destroy the physical storefront, and with its growth surge losing steam in the wake of loosening COVID-19 protocols, Shopify has similarly  downsized to cut costs and get back to profitability.

In the second quarter, its revenue increased 31% year over year to $1.7 billion. Adjusted operating income was $146 million, up from a $42 million loss last year. Its unadjusted operating loss was $1.6 billion, but that reflected an impairment charge of $1.7 billion related to the sale of its logistics network, a big decision among company leadership to refocus on the core platform. Without that costly one-time expense, operating income would have been positive, which hints at stronger profitability going forward. 

What's the market opportunity?

Focusing on its core activities doesn't mean the company won't innovate or launch new products. It has had great success with targeting new demographics and offering more services and flexible packages. Those efforts include targeting enterprise customers on top of its sweet spot of small businesses, and Shopify now provides services for large companies like Gap and Kraft Heinz.

It just launched a new program called Shopify Components that allows users to pick and choose which services they want without committing to an entire package. That's particularly useful for some bigger clients that don't necessarily need to outsource the creation and support of their whole e-commerce site but might want a payments solution, for example.

And while e-commerce may not have turned out to be quite the brick-and-mortar killer that some people previously thought it would be, it's still growing. According to Adobe Analytics, e-commerce sales are expected to grow at a rate of at least 8% annually over the next several years. And according to Statista, in 2025, total global e-commerce sales will be 50% higher than their 2021 level.

Shopify is well-positioned to benefit from this growth organically, but it should also be able to capture additional share as it releases new products and targets new markets.

What a premium valuation implies

Valuation signals to investors what the market thinks about a company's prospects, but it's all relative. Reality almost always catches up with stock prices that are too low or too high as compared with a company's real performance and opportunities. That's why investors like Warren Buffett look for stocks that are undervalued -- their prices are bound to rise to meet the true value of the business. In contrast, if a stock is priced too high, it's likely to fall. Hype is not sustainable, although it could last for a long time.

Shopify looks like it has a long growth runway, but much of it is already baked into the stock price. It's not growing fast enough to warrant such a high premium, nor is it consistently profitable.

The stock should be a long-term winner, but the broad market has a winning track record too. Investors should recognize shares may not move meaningfully higher in the short term as the company's results still need to catch up with the stock's valuation. Most investors should keep it on their watch lists and wait for a better entry point.