After years of flattish performance, Shake Shack (SHAK 4.81%) shares finally took off earlier this year. Shake Shack stock more than doubled between the beginning of 2019 and September, including a big jump following the company's strong Q2 earnings report in early August.

However, in recent weeks, the stock started to retreat. That retreat turned into a rout on Tuesday, with Shake Shack stock falling 21% after the company lowered its 2019 guidance and warned investors that the shift to an exclusive delivery partnership with Grubhub (GRUB) would lead to near-term sales headwinds.

SHAK Chart

Shake Shack Stock Performance, data by YCharts.

This sell-off has erased a substantial chunk of Shake Shack stock's gains for the year. Given that the disruption from the delivery transition is likely to be temporary, this represents a great opportunity for long-term investors to buy shares of this exciting growth stock.

Shake Shack delivers solid results but tweaks guidance

Last quarter, Shake Shack's total revenue surged 31.9% year over year to $157.8 million as the fast-casual burger joint continued to aggressively expand. Shake Shack ended the third quarter with 254 restaurants on a systemwide basis, up from just 188 a year earlier. The company has been adding both company-owned and licensed locations at a rapid pace in recent years. As of late September, it had 151 domestic company-owned restaurants and 103 licensed locations, mainly outside of the U.S.

Comparable sales rose 2% in the third quarter, due to modest traffic growth in established restaurants and the impact of price increases. However, barely more than half of the chain's domestic restaurants are included in the comparable base, with the remainder having opened within the past two years. As a result, comp sales metrics are less important for Shake Shack than for most restaurant chains right now.

Unfortunately, Shake Shack's restaurant-level operating margin contracted to 23.1% last quarter, compared to 25.8% in Q3 2018. As a result, despite the company's massive sales growth, adjusted net income rose by a comparatively modest 28% to $10 million, or $0.26 per share.

Shake Shack also updated its guidance this week. It raised its full-year revenue outlook by $7 million, to a new range of $592 million to $597 million, as it has been able to accelerate the opening of new restaurants. However, it cut its full-year comp sales growth forecast from 2% to 1.5% due to disruption from the Grubhub delivery transition. It also reduced its forecast for restaurant-level operating margin from 23% to a range of 22% to 22.5%, mainly due to a recent uptick in beef costs.

People standing in line outside a Shake Shack restaurant.

Shake Shack has continued its rapid growth this year. Image source: Shake Shack.

What's going on with Grubhub?

The comp sales guidance cut was probably the main reason why Shake Shack stock plunged on Tuesday. Three months ago, the company announced a partnership that will make Grubhub its only official delivery provider. Other services like Caviar, DoorDash, and Postmates that work with Shake Shack today won't be banned from delivering the chain's food, but by the end of this year, their platforms will no longer be integrated directly with the point-of-sale systems in Shake Shack's restaurants.

This transition will create some sales headwinds. For one thing, Grubhub's rivals no longer have an incentive to promote Shake Shack. Additionally, if those rivals stop offering Shake Shack deliveries entirely -- which seems quite probable -- people who prefer to use those services rather than Grubhub may become less likely to order food from Shake Shack. This problem will be particularly acute in markets where Grubhub has low market share.

That said, there's a lot of upside from this transition, too. Management emphasized that the Grubhub partnership will allow Shake Shack to minimize the time between when an order is cooked and when the driver picks it up. This will lead to higher food quality for delivery customers.

There will also be more tangible financial benefits from the Grubhub partnership. Grubhub has agreed to invest in marketing for Shake Shack, which should offset the loss of other delivery partnerships over time. Additionally, Shake Shack was able to negotiate better economics from Grubhub in return for exclusivity, which should reduce the margin drag from delivery.

Investors are overreacting

After its big drop on Tuesday, Shake Shack stock continued to fall on Wednesday. However, investors appear to be overreacting to the company's updated guidance.

First, the switch to an exclusive delivery partner will significantly reduce complexity in Shake Shack's restaurants and make it easier to serve delivery customers. That should be good for sales and profits in the long run, despite some short-term disruption. (There's a clear parallel to Starbucks' ultimately successful delivery transition in China over the past year and a half.)

Second, despite some expected margin pressure this quarter, Shake Shack's restaurant-level margins are extremely good by industry standards. Management has been very conservative about raising prices during periods of high cost inflation, because the brand is still very new in many markets. In the long run, Shake Shack should be able to recover cost increases through higher pricing. Additionally, as the company gains scale in the years ahead, its profit margin should improve significantly.

Shake Shack sees room to expand its domestic company-owned store base to at least 450 restaurants -- roughly triple its current size. Even that estimate is probably quite conservative. There's even more room for expansion outside the U.S. Thus, Shake Shack's growth is just getting started. There will inevitably be more volatility in the years ahead, but Shake Shack stock looks attractive for long-term investors following its recent pullback.