If there's one consumer niche that is known for being recession proof, it's pet supplies. Yes, people often make big changes to their own grocery budgets during downturns. But they aren't as quick to shake up a pet's diet.

Yet Chewy (CHWY 2.99%) stock has dropped harder than the market this year despite showing solid sales growth through the early summer months. Let's take a look at whether that slump creates a golden buying opportunity for the e-commerce giant.

Capturing market share

Chewy's last operating update contained none of the warning signs that might portend a big demand drop ahead. Sales growth slowed, to be sure. Chewy logged a 13% revenue boost in Q2, while investors had been seeing a 27% expansion pace in mid-2021.

But Chewy's results also show the type of resilience you'd expect from a business that can withstand a recession. Roughly three-quarters of sales occurred through its subscription service, for example. Its highly engaged customer base continued spending on essential pet supplies, management explained in a late August conference call. Chewy's market share gains reflected these "distinct structure advantages in the current environment," CEO Sumit Singh said.

Boosting profits

Chewy is also a standout when it comes to profitability. While many e-commerce specialists have swung to net losses in recent quarters, this retailer is doing better than its peers. Gross profit margin rose by 0.6 percentage points in Q2, and the adjusted net profit margin was up, too.

Chewy's adjusted profitability has improved to 3% of sales from 2.3% over the first half of fiscal 2022, thanks mainly to rising prices. That pricing power, combined with steady market share gains, implies solid investor returns over time.

Buy now or wait?

It hasn't all been good news for Chewy. The company is winning fewer new customers in 2022 as pet adoption trends settle back down to more normal levels. The stock's surge through 2021 reflected the judgment by many investors that the pandemic lift in pet ownership rates might stay permanently higher. That didn't happen, and the resulting shift is why sales are up more modestly right now.

That slowdown is the main reason why Wall Street is avoiding the stock today. Chewy might be in for several more quarters of sales growth that's closer to 10% than the 20% rate shareholders had been enjoying.

But waiting for that temporary hangover to pass would likely mean an investor would miss out on the stock's recovery. Instead, consider buying Chewy with an eye toward the next several years rather than the next few quarters.

Its stable, highly profitable business provides a nice cushion against the prospect of a deeper recession developing into 2023. Chewy has a knack for winning market share in many selling environments too and would likely emerge from any pullback with a more premium industry position.

In any case, its pet essentials niche, which makes up around 80% of the business, isn't likely to plunge through any wider consumer spending pullback. As a result, Chewy looks like one of the more attractive e-commerce stocks to have in your portfolio through the 2022 volatility and beyond.