Walmart succeeded in breaking up groups of plaintiffs in gender discrimination suits federal court in Florida.

The belt tightening could be about to begin for real.

Fashion retailers have spent several years in transformation mode as they adapted to a rapidly changing consumer. And while that has meant store closures and cutbacks, retailers have also been spending more in hopes of keeping up with shoppers. That includes millions of dollars to sharpen e-commerce offerings, to build omni experiences and the rest.

The spending has largely been seen as necessary, particularly as Amazon grabbed fashion market share and more shoppers find brands through social platforms. But the expenditures were also made against a backdrop of growing sales and a historic bull market. And e-commerce sales, with all their returns and other expenses, are weighing heavily on margins.

Now, while retailers are pushing on with what they see as key capital projects for a new age, they are preparing to be more flexible as the economy shows signs of wobbling and a tentative recession watch begins. Macy’s Inc. on Tuesday said that its comparable sales grew 2 percent last year, including licensed departments, and that it was looking to bolster the impact of that growth trend by operating more efficiently. Accordingly, the retailer laid out a restructuring that “reduces the complexity of the upper management structure” and helps save $100 million annually.

Cutting back to support the bottom line is often smart in good times, but usually necessary when the going gets tough.

And while fears of an economic slowdown ebb and flow, there always seems to be new cause for worry — the most recent being an extremely weak reading on official holiday sales, which were so bad economists suspect they might be due to some kind of a government shutdown-related glitch.

Regardless, the retail turmoil is real.

A recent survey by BDO found that 44 percent of retailers are “actively preparing for a market correction” while half of the 300 executives surveyed said their companies “need outside capital to remain stable.”

“The majority of retailers are stuck in survival mode,” said Natalie Kotlyar, national leader of BDO’s retail and consumer products practice. “Playing catch-up in perpetuity is preventing retailers from seizing new opportunities and leapfrogging the competition.”

The BDO report showed that the companies that are thriving are planning ahead and preparing for a downturn while most of the companies that are just getting by “are taking a wait-and-see approach.”

On many fronts and across the industry, ambitions are still high, but plans are more cautious and rely on being careful with the pocketbook.

Luxury jeweler Tiffany & Co., for instance, is projecting a low-single digit rise in sales for the year ahead, but a mid-single digit increase in earnings.

“We will have an agile approach to things,” Alessandro Bogliolo, chief executive officer of Tiffany & Co., told WWD last month.

“Our industry is very capital intensive,” Bogliolo said. “We have committed to big projects hundreds of millions of investment [dollars]. These hit the profitability in the short-term, you have to spend money. We have to compensate for this increased expense by being more efficient.”

That’s a balance that will be easier to keep for luxury players, which have a higher margin anyway, and for the giants of the realm.

Everyone else might have to dig deep or just grin and bear it.

Simeon Gutman, an analyst at Morgan Stanley, upgraded shares of Walmart Inc. recently, praising the company’s expense positioning after a long period of spending.

“After five years of declines, we expect U.S. [earnings before interest and taxes] to inflect in 2019, thanks to continued sales momentum, heightened cost control, and improving e-commerce margins,” Gutman said.

“Cost control has higher priority,” he said of Walmart’s recent moves. “Introducing zero-based budgeting, lapping store/wage investments, and stopping all store expansion, a historic decision, are the tools to drive leverage. E-commerce margins could improve. While e-commerce losses will likely grow in 2019, our work indicates e-commerce expenses are leveraging as the bulk of fixed cost investments have been made.”

The result of all this work will be key headed into any kind of economic slowdown. (Walmart showed off its strength for the fourth quarter, reporting last week that U.S. comparable sales increased 4.1 percent and helped drive net income up 69.5 percent to $3.69 billion. Also helping the bottom line was a 4.6 percent drop in operating, selling, general and administrative expenses, to $27.81 billion. That marked an expense turnaround from the first nine months of the year, when expenses rose 2.6 percent to $79.33 billion).

“Walmart U.S. can now generate sales growth without sacrificing margins, in our view, in contrast to most retailers,” Gutman said.

Indeed, it’s a trick that’s much harder to pull for retailers living more hand to mouth and still looking for positioning and starting to wonder more about the future.

“Consumer sentiment is pretty good, but there are a lot of headwinds out in the market and unknowns,” said Steve Goldberg, president of consultancy The Grayson Company. “It’s a mixed bag coming in to ’19 and ’20.”

Goldberg said strong cost controls are just “prudent.”

“Investments are continuing to go into areas like customer experience, IT — areas that will facilitate the operation of a business and make them more nimble,” he said.

Expect other spending — like the Facebook ads that bring in shoppers, but can be tricky to manage — to go under the microscope.

“The variability and uncertainty of customer acquisition, particularly in the digital world, is still a work in progress,” Goldberg said. “A lot of companies have really learned the lesson of, just when they think they have the formula down, either the customer pivots or they’re learning that Facebook has pivoted. There’s a lot of variability in customer acquisition and retention. That’s going to continue to be expensive and I think that’s an area where companies have realized that they have to be laser-focused and extremely prudent.”

A spending crunch would further exasperate the woes of the stores.

Most retailers have seen customer traffic slow and while store closures have helped some, more retail locations could go dark as the industry shifts its focus.

“Retailers are struggling with the role of the stores and how they service customers and how they manage the cost equation,” said Jon Weber, managing director and head of L.E.K.’s global retail and consumer practice.

Fulfilling web orders from stores, for instance, can put more of a burden on the people who work on the front lines and are also responsible for maintaining customer service levels.

“There’s a whole host of things the stores are needing to do now to justify their costs in a world where productivity is being pressured,” Weber said. “Everybody’s got all these ideas for how to improve the stores on a dimension. But how it all kind of ultimately works together to deliver the objective, I think, is something that’s been missing.”

For retailers who are not able to solve that puzzle or are not providing anything special to customers, a recession could become too much.

“There will be shakeouts through the next recession for sure, because there are plenty of specialty retailers out there who are just getting by today and they have to ask themselves, do they really have a reason to be?

“The world hasn’t gotten less promotional,” he said, noting that prices fell after the Great Recession and never really rebounded. “The idea was to, at some point, pull back as the economy improved and the consumer got healthy, actually that really never happened.”

For many, the next slowdown, whenever it comes, could be too much to handle.