Warren Buffett believes in buying great businesses, even if that means paying a small premium. On countless occasions, he has purchased shares in a company only to buy even more shares later at an even higher price. "It's far better to buy a wonderful company at a fair price than a fair company at a wonderful price," he once quipped.

But sometimes, it's possible to buy a wonderful company at a wonderful price. That possibility is currently a reality with Shopify (SHOP 0.80%) stock, which is down 59% over the past three years. There are two main reasons this company should join your portfolio today.

Shopify is a growth superstar

Consider iconic companies like Visa, Meta Platforms, and Amazon. What do these businesses have in common? They all benefit from network effects. Network effects describe how a particular product or service grows in value as more people use it. As more people use Visa credit cards, for example, more merchants are incentivized to accept them, which only spurs even more adoption from consumers. The same is true for social media networks like Facebook and Instagram -- both of which Meta Platforms owns. It's also true for Amazon, which attracts more merchants by adding more customers, and attracts more customers by adding more merchants.

There's a reason why Visa, Meta Platforms, and Amazon are some of the most valuable companies on the planet. Once set in motion, network effects are hard to stop. Because these markets benefit from scale, they naturally lead to industry consolidation. All three companies, for instance, dominate their industries with huge market shares.

When it comes to network effects, Shopify is right up there with Visa, Amazon, and Meta Platforms. At its core, Shopify is an e-commerce company. But it doesn't sell directly to consumers. Instead, it powers the software that allows more than 1 million retailers to sell online. In a few clicks, anyone can begin selling online, with design, inventory, payment, and advertising capabilities built right into their Shopify-powered website. According to Statista, Shopify controls 28% of the U.S. market for e-commerce platforms -- almost as much as the next two competitors combined. And there's reason to believe this market share dominance will expand even further.

E-commerce is a huge market. By 2027, global e-commerce spending is expected to surpass $8 trillion. Much of that will be directed to huge, centralized marketplaces like Amazon. However, a sizable share will also be directed to individual e-commerce sites, such as those powered by Shopify. E-commerce platforms that make sellers the most money will win long-term. Shopify has a huge lead in this department. As the largest competitor, it has more investable funds than the competition. This is particularly useful, given the rise of artificial intelligence (AI). AI is costly to develop, but it can help retailers optimize inventory, better display tailored search results, interact in real time with customers, and boost advertising conversions. Shopify regularly adds new AI tools to its platform. As more customers join for these capabilities, it has even more resources and data to refine its offerings further, which only fuels its ability to invest further -- network effects in action.

While Shopify's growth rates have come down sharply as it has grown, revenue is still consistently growing by more than 20% per year. Given that e-commerce spending is growing by around 7% per year, and the fact that network effects should allow Shopify to take market share from competitors for many years to come, it shouldn't be hard for the company to maintain double-digit growth rates over the next decade. Earnings growth should follow. Wall Street analysts, for example, expect Shopify to grow earnings by an astounding 36% annually over the next five years.

SHOP Revenue (Quarterly YoY Growth) Chart

SHOP Revenue (Quarterly YoY Growth) data by YCharts

Shares are a buy for this reason

Growth is just one side of the coin. There's also the price you must pay for the stock. Shopify shares undeniably trade at a premium, but they're relatively cheap following a recent correction.

Right now, Shopify stock is valued at 11 times sales. At the start of 2024, they were valued at nearly 17 times sales. In 2020, when revenue growth rates were above 100% per year, shares traded above 60 times sales! To be sure, those days of seismic growth are far behind us. But as we've learned, the massive and growing e-commerce market gives Shopify the benefit of a long-term rising tide. Network effects, meanwhile, will allow it to outpace this underlying market growth.

Based on next year's sales, Shopify trades at just 7.9 times sales. That's still expensive, but given consistently high growth rates, it's not hard to see how Shopify shares today end up looking like a steal a few years down the road. This investment will take patience to pay off, and the upfront premium is hard to stomach. But as Warren Buffett advises, paying a premium for a high-quality company like Shopify is usually a wise decision. Just make sure your investment horizon is long enough to stomach the volatility.