SEATTLE — Starbucks Corp. suspended its outlook for fiscal 2022 as COVID lockdowns in China weighed on second-quarter earnings. Strong demand for cold beverages and record food attach in North America helped offset the impact of the pandemic’s resurgence, but the company struggled to keep pace with “relentless” demand from US consumers, said Howard Schultz, founder and chief executive officer.

Net income for the second quarter ended April 3 was $675 million, equal to 58¢ per share on the common stock, up 2.4% from $659 million, or 56¢ per share, in the same period a year ago. Quarterly sales rose 15% to $7.6 billion from $6.7 billion. Higher costs for commodities and labor dragged on operating margins, which condensed to 17% in the quarter versus 19% a year ago.

International same-store sales fell 8% in the quarter, driven by a 23% decline in China, where a third of the company’s stores are temporarily closed or only accepting delivery orders due to COVID lockdowns.

North American business unit sales grew 17% to $5.4 billion, with same-store sales up 12%. The growth was attributed to a 7% increase in average ticket size and a 5% increase in transactions. Starbucks benefited from sustained momentum across cold beverages, and from new menu items, including its pistachio latte. Food sales were up 25% from a year ago.

While demand remains strong in the United States, the company’s employees have been unionizing to earn better pay and working conditions. More than 240 Starbucks stores across 32 states have filed for union elections. Approximately 50 company-owned locations have voted in favor of unionizing in the past six months.

In an effort to curb the unionization push, Starbucks announced it will invest $1 billion in its employees and stores in fiscal 2022. The investment, which includes increased pay, expanded benefits and additional training for baristas, will not extend to stores that have unionized or are in the process of unionizing, Mr. Schultz told financial analysts during a May 3 conference call to discuss second-quarter results.

The investment follows a previous commitment to raise the minimum wage for all US employees to $15 per hour.

“Federal law prohibits us from promising new wages and benefits at stores involved in union organizing,” Mr. Schultz said. “By law, we cannot implement unilateral changes at stores that have a union.”

As part of its investment, Starbucks will accelerate the rollout of new ovens, espresso machines and other restaurant technologies. The spending will help the company keep pace with customer traffic and changing consumer behavior, Mr. Schultz said.

“In our stores customers are increasingly further customizing already complex handcrafted cold beverages,” he said. “The combination of shifts in customer patterns, accelerating demand and algorithms built for different customer behaviors has placed tremendous strain on our US store partners.”

Starbucks also plans to accelerate new store growth with 90% of new locations featuring drive-thrus, along with technology and equipment improvements to increase speed of service for off-premises orders. Drive-thru and mobile ordering accounted for 70% of US store volume in the second quarter. Delivery, nearly a $500 million business for Starbucks, was up 30% for the first half of the year.

Underscoring the upcoming investments in people and technology, Starbucks moved its 2022 Investor Day from December to September. The event will showcase “significant innovation around technology and personalization,” according to the company.

“Companies spend hundreds of millions of dollars on marketing, promotions and social media trying to create demand,” Mr. Schultz said. “We have demand everywhere we look, despite having not lived up to the expectations we set for ourselves. The biggest opportunity ahead for us is to meet strong and growing demand in our stores more efficiently and effectively, and to leverage technology to enhance productivity and reduce the burden on our store partners.”