The stock market has taken investors on a wild ride over the last few years, but opportunity in the markets favors those with an optimistic outlook about the future. Investors that stick with growing companies that are selling at cheap valuations will often be rewarded over the long run.

Today we'll check out two bargain candidates, Williams-Sonoma (WSM 3.62%) and PayPal Holdings (PYPL 2.43%). These companies are still reporting profitable growth in this turbulent economy, and their low price-to-earnings ratios suggest the market is significantly undervaluing their futures.

1. Williams-Sonoma

Wall Street is asleep at the wheel on this one. The home retailer wrapped up a strong year, with comparable brand revenue increasing 6.5% for fiscal 2022 ending in January. Core brands, including Pottery Barn, West Elm, and Williams-Sonoma, were all responsible for these gains. Balanced growth across these brands in a bumpy economy indicates management has the right strategy in place to drive solid performance over the long term.

"With our relentless focus on customer service and profitable growth, we continue to outperform our peers, gain market share, and distinguish ourselves as the world's largest digital-first, design-led, sustainable home retailer," CEO Laura Alber said in the company's recent earnings report. 

This is nothing new if you've been following the company in recent years. Williams-Sonoma's quarterly revenue is up 46% from the same quarter five years ago, and has accelerated over the last few years, with no signs of slowing down. 

WSM Revenue (Quarterly) Chart

WSM Revenue (Quarterly) data by YCharts

Management credits its in-house design capabilities, vertically integrated sourcing model, and high-quality and sustainable products at value prices. 

One area where management identified a major source of future growth is business-to-business (B2B) sales. The B2B business reported revenue growth of 27% year over year last quarter. 

Investors can buy into this exceptionally well-managed retailer for a bargain price-to-earnings ratio of 9 based on forward earnings estimates. Shareholders also get paid a nice dividend yield of nearly 2% while they wait.

2. PayPal

E-commerce and digital payments are massive long-term growth opportunities for leading platforms. PayPal is already doing well in this race, with 435 million active accounts, which also includes the popular peer-to-peer payment service Venmo. Analysts have been quick to point to increasing competition from Apple Pay over the last year for PayPal's slowing growth, but there's more to the story.

PayPal was regularly posting growth in total payment volume across its network of above 25% before the pandemic. The reopening of the economy and the macroeconomic headwinds put a halt to its momentum, but PayPal is still growing its branded checkout volumes in line with the global e-commerce market. 

Most importantly, PayPal has experienced strong results from its Buy Now, Pay Later service, driving higher conversion at checkout and incremental payment volume. 

Meanwhile, the company is set to ramp PayPal Complete Payments for small and midsized businesses. During the fourth-quarter earnings call, CEO Dan Schulman said this initiative will "meaningfully expand our unbranded total addressable market by as much as $750 billion." 

Management's first-quarter revenue guidance points to stabilizing growth at 9% year over year on a constant-currency basis. Operating cost leverage should boost adjusted earnings per share by 24% at the midpoint of guidance, which should be more than enough to lift this beaten-down stock out of its slump.

Shares trade at a low forward price-to-earnings ratio of just 15. PayPal is set to deliver robust profit growth this year, but sells for a discount to the average valuation of most growth stocks. That's a bargain for one of the leading mobile payment providers in the world.