A.H. Beard, a 123-year-old luxury mattress manufacturer based in Australia, started eyeing China around 2010. At the time, the family-owned company faced looming competition from low-cost, foreign-made mattresses in its home market. China, with its 1.4 billion consumers and a growing middle class with a taste for premium brands, seemed like a good place to expand.The choice paid off.A.H. Beard opened its first store there in 2013. Before the coronavirus pandemic, sales in the country were growing more than 30 percent a year. There are now 50 A.H. Beard stores across China, with plans to open 50 more. But like most foreign companies operating in China nowadays, A.H. Beard has started to think more carefully about its strategy.Beijing’s strict Covid-19 policy has exacted a heavy toll on business. The company’s exports into China are no longer on the rise.This month, Chinese officials announced that the economy grew at its slowest pace since the early days of the pandemic. Unemployment is high, the housing market is in crisis and nervous consumers — living under the constant threat of lockdowns and mass testing — are not spending.Now, the once resilient Chinese economy is looking shaky, and the companies that flocked to the country to partake in boom times are being confronted by a sobering reality: flat growth in what was once seen as a reliable economic opportunity.“I certainly don’t see China returning to the rates of growth that we had seen previously,” said Tony Pearson, chief executive of A.H. Beard.So far, most companies are staying the course, but there is a steady whiff of caution that did not exist just a few years ago.Geopolitical tensions and a U.S.-China trade war have unleashed punishing tariffs for some industries. Covid-19 has snarled the flow of goods, lifting the prices of almost everything and delaying shipments by months. China’s pandemic response of quarantines and lockdowns has kept customers at home and out of stores.A.H. Beard opened its flagship store with a local partner in Shanghai almost 10 years ago. And like any high-end brand, it rolled out products with prices that defy belief. China became the best-selling market for its top-of-the-line $75,000 mattress.Since then, the cost of shipping a container has jumped sixfold. The cost of mattress materials and components, such as latex and natural fibers, have increased significantly. Other worrying signs have emerged, including a housing slump. (New homes often mean new mattresses.)Mr. Pearson said he is hoping that the Chinese Communist Party congress later this year will clarify “the trajectory for China” and imbue consumers with more confidence. “The economy still has growth potential,” he said. “But there’s always a degree of risk.”After the 2008 financial crisis when the rest of the world retrenched, China emerged as an outlier and international businesses rushed in.European luxury brands erected gleaming stores in China’s biggest cities, while U.S. food and consumer goods companies jostled for supermarket shelf space. German car manufacturers opened dealerships, and South Korean and Japanese chip firms courted Chinese electronics makers. A booming construction market fueled demand for iron ore from Australia and Brazil.Chinese consumers rewarded those investments by opening their wallets. But the pandemic has rattled the confidence of many shoppers who now see rainy days ahead.Fang Wei, 34, said she has scaled back her spending since she left a job in 2020. In the past, she spent most of her salary on brands like Michael Kors, Coach and Valentino during frequent shopping trips.Updated July 27, 2022, 4:41 p.m. ETEven though she is employed again, working in advertising in Beijing, she now allocates a quarter of her salary on food, transportation and other living costs. She hands the rest to her mother, who puts the money in the bank.“Because I’m worried about being laid off, I transfer everything to my mother every month,” Ms. Fang said. “It’s very depressing to go from enjoying life to subsistence.”A more frugal Chinese consumer is a worry for foreign businesses, many of which offer products that are not the low-cost option but a premium alternative. An Jun-Min, chief executive of Ginseng by Pharm, a South Korean producer of ginseng products, said he, too, has noticed Chinese “wallets have gotten thinner.”Mr. An said sales for the company’s main product, a 2 ounce bottle of a ginseng drink that sells for $18, peaked before the pandemic. The company shipped 600,000 bottles into China and Hong Kong in 2019.Sales plunged in 2020 because it was hard to get products into the country during Covid lockdowns. Business has mostly bounced back, although it is still down 10 to 20 percent from the peak.While Mr. An said he is concerned about the economic slowdown, he remains optimistic that the market for health products in China, and a familiarity with ginseng — an aromatic root said to have health benefits — will continue to benefit sales. To hedge his bets, though, he is also seeking regulatory approval to sell in Europe.That is a far cry from the unbridled optimism of the past.In 2016, when China was its fastest growing and most profitable market, Kasper Rorsted, the chief executive at Adidas, declared that the country was “the star of the company.” Adidas invested aggressively to expand its foothold. It went from 9,000 stores in China in 2015 to its current 12,000, though only 500 are operated by Adidas. Then the music stopped.After initially projecting that sales in China would accelerate this year, Adidas ratcheted down expectations in May as Covid lockdowns continued to spread. The company said it now expects China revenue to “decline significantly” and that a sudden rebound is unlikely.For now, Adidas remains undeterred. Mr. Rorsted said on a call with analysts that the company is not planning to slash costs or pull back from the country. Instead, it will “do whatever we can to double down and accelerate the growth.”Many foreign companies had bet on the rise of a Chinese middle class as a dependable source of that growth. Bain & Company, a consulting firm, said it expects China to be the world’s largest luxury market by 2025, fueled in part by what Federica Levato, a senior partner, said is still “a big wave” of a rising middle class.But those kinds of predictions look less enticing for some foreign companies that once relied heavily on the Chinese market.Kamps Hardwoods, a Michigan-based manufacturer of kiln-treated lumber used for homes and furniture, seized on the opportunity to expand in China — at first. At a Chinese trade show in 2015, Rob Kukowski, the company’s general manager, said a Chinese buyer stunned him with a huge offer to buy enough stock to fill 99 shipping containers. The $2 million order of lumber accounted for four months’ worth of business for Kamps.Chinese buyers were so desperate for lumber back then that they would visit the company’s booth and refuse to leave until Mr. Kukowski accepted a million-dollar deal on the spot. By 2016, China accounted for 80 percent of the company’s sales.Kamps soon realized that it was hard to make a profit from the large Chinese orders because many buyers were not interested in quality and only wanted the cheapest possible price. The company started to focus its effort on finding customers in the United States and other overseas markets who were willing to pay more for a better product.It was fortuitous timing. When China raised tariffs on U.S. lumber in 2018 as part of a trade war, Kamps was better positioned to weather the downturn. Today, China accounts for only 10 percent of Kamps’s sales, but it still has a large indirect impact on the company. Mr. Kukowski said China is such a big buyer of U.S. lumber that a downward price war ensues throughout the industry when it stops spending.“With their purchasing power being so strong and so much of our product going into that market,” Mr. Kukowski said. “Our industry is going to run into significant problems if their economy slows.”Jin Yu Young contributed reporting. Claire Fu contributed research.