Some of the world's top stocks are heading for losses this year -- even double-digit losses. Two examples? A coffee shop giant and a leading maker of athletic gear. I'm talking about Starbucks (SBUX -0.79%) and Nike (NKE -2.10%). Higher inflation and coronavirus disruptions in the companies' big market of China have put pressure on margins. And investors have shied away.

But things may be turning around. Over the past month, Starbucks and Nike shares have started to gain. And recent earnings reports show these companies have what it takes to perform over the long term. Let's take a closer look at these two stocks to buy before they take off.

1. Starbucks

Starbucks has a solid track record of increasing revenue over time. The loyalty of Starbucks' customers has kept revenue growing at the coffee chain. In the most recent quarter, U.S. active membership in the Starbucks Rewards program climbed 16% to 28.7 million. And these members represent more than half of spending in Starbucks' U.S. stores.

To keep these customers coming back, Starbucks prioritizes innovation. A great example of this is the company's development of cold brew and personalized beverages. Today, cold coffee represents 76% of Starbucks' beverage sales. And 60% of beverage sales are personalized.

Even in the current difficult economic environment, Starbucks' revenue continues to climb. In the quarter, revenue rose 11% to a record $8.4 billion.

Two important catalysts lie ahead for Starbucks. One is the relaxing of coronavirus restrictions in China. As mentioned above, China is a key market for Starbucks. More than 60% of the company's stores are located in the U.S. and China. So, as people return to their routines in China, Starbucks' revenue should pick up.

The other catalyst is the company's reinvention plan. The focus areas include beverage innovation, boosting growth in ready-to-drink products, and accelerating Starbucks' digital growth worldwide. The three-year plan is meant to deliver double-digit annual revenue growth and non-GAAP (adjusted) earnings-per-share growth.

Starbucks shares trade for around 30 times forward earnings estimates. That's down from about 40 earlier in the year. But the discount may not last long as Starbucks progresses on its growth plan -- and recovers in China.

2. Nike

Higher transportation and logistics costs have hurt Nike in recent times. A stronger dollar also has weighed on sales made abroad. They're worth less when brought back home. And, like Starbucks, Nike's business in China has suffered due to coronavirus restrictions.

But there's reason to be positive about Nike over the long term. The company's brand strength is unwavering. It's still a No. 1 brand in its major markets of North America and China. Nike's total revenue, digital revenue, and Nike Direct revenue each rose in the double digits in the most recent quarter, excluding the currency impact. That's key because it shows demand remains strong.

In fact, in the most recent quarter, Nike Digital posted its highest revenue ever. This is thanks to an effort Nike launched back in 2017 -- to focus on digital and selling directly to fans online and through its stores.

The company continues to engage directly with consumers through its apps, too. For example, the SNKRS app helps Nike connect with fans ready to snap up its latest sneakers as soon as they're available. A record 3.8 million users signed up for the Travis Scott Air Jordan 1 sneaker drop in July.

Today's challenges for Nike are linked to the economy. These problems won't disappear overnight. But they won't last forever either. Nike's connection with fans and revenue growth in spite of today's difficult environment are reasons to be optimistic about the long term. And the loosening of coronavirus restrictions in China could help Nike in the near term

Trading at 37 times forward earnings estimates -- down from more than 48 last year -- Nike looks like a deal. And with any bit of positive news, the stock could take off.