Last year was tough on growth stocks, but 2023 has been the complete opposite. Many companies have rocketed higher this year with names such as e-commerce software provider Shopify (SHOP 1.11%) leading the charge. The Canadian tech business has seen its shares rise 120% this year. However, after such a brutal 2021 and 2022, the stock is still down 55% from the all-time high it set during the pandemic stock market bubble.

After building such strong momentum this year, let's see if this growth investor favorite can extend its rally in 2024 and beyond.

Profit inflection, durable revenue growth

The key to Shopify's turnaround has been an inflection for its profit margins. After planning a rapid -- and expensive -- expansion into logistics and delivery services for its merchant customers, Shopify finally gave up on that project earlier this year. It also laid off 20% of its employees after hiring too many people during the pandemic bubble period.

As a software and payments provider for e-commerce websites, Shopify has fantastic unit economics. It only requires a small incremental cost to serve more customers given the asset-light nature of its core business. With these recent cost savings, Shopify is now showing how profitable its core business can be. It also doesn't hurt that the company decided to hike its subscription prices by as much as 33% to start the year.

In the third quarter, Shopify's revenue grew 25% year over year to $1.7 billion. More importantly, operating margin was 7%, a stark reversal from the steep losses in the year-ago quarter. Over the next few years, investors should expect Shopify's operating margin to continue climbing higher.

Competitive threats from an industry giant

Shopify's income statement looks quite strong today. It's no surprise, then, to see shares more than double this year. But there are some looming threats on the horizon that could impede its growth plans this decade.

Specifically, we need to talk about Amazon and its Buy With Prime service. Released in 2022, Buy With Prime is a payment button that merchants can put on their own websites. However, unlike traditional checkout methods, this allows Amazon Prime members to enjoy key benefits of the program -- most importantly, fast shipping -- outside of Amazon's own website. This provides significant value to merchants as customers love fast shipping times. Early data from Amazon shows that merchants get a 25% uplift in sales when enabling Buy With Prime on their websites. This is a huge deal for small e-commerce retailers.

How does this hurt Shopify? The company's largest revenue driver is its Shop Pay checkout solution, which allows it to earn a fee on every dollar spent on its merchants' websites. If customers switch to Buy With Prime, this revenue stream would dry up. When Buy With Prime first launched, Shopify discouraged merchants from using it. But recently, it came to an agreement with Amazon to officially integrate Buy With Prime into Shopify's platform.

As a result, Shopify is likely earning less revenue from Shopify Payments when shoppers check out using Buy With Prime, which could present a headwind to Shopify's profit potential this decade if the service gains widespread adoption.

SHOP Revenue (TTM) Chart

Data by YCharts.

You can't forget about valuation

Buy With Prime is something to watch, but it won't stop Shopify from growing long term. Shopify remains a definitive leader in e-commerce software that can tap into the tailwinds from the rising popularity of online shopping in North America (and around the globe).

Even so, Shopify is a bad bet for investors in 2024. Why?

One word: valuation.

Shopify sports a market cap of $99 billion as of this writing. Over the last 12 months, it has generated $6.7 billion in revenue. Let's be very optimistic and say that can almost double in three years to $13 billion. Shopify is reporting a net loss in 2023 year to date, but let's assume it can deliver a 20% profit margin by 2026. At those levels, the stock would trade at a price-to-earnings ratio (P/E) of 38.

Today, the S&P 500 has a forward P/E of 21. So even if Shopify doubles its revenue and significantly expands its profitability over the next three years, all while experiencing no change to its share price, its valuation will still be twice that of the broad market. With such a steep premium, Shopify is a bad bet for investors in 2024. Price matters, even for compelling growth stocks like this one.