Warehouse retail giant Costco Wholesale (COST 1.01%) has delivered market-stomping shareholder returns over the last three years. The gains only grow more impressive if you stretch the time scale to five years, a decade, or more.

But the stock's past performance is not a guarantee of future success. What will Costco's market environment look like three years from now, and how will the changes affect this resilient business?

I have found three unstoppable economic trends that should hold the key to those questions. So let's look at what's up next for Costco, its customers, and its shareholders.

1. The economy should be back on track

If we're still dealing with the fallout from the inflation crisis in 2026, we'll need more than a bulk shipment of umbrellas to weather the storm. Likewise, the continuous waves of disruption that started with the COVID-19 pandemic in 2020 (including the inflation surge) should stop drenching the American and global consumer markets in fresh troubles by then.

With the economy back on its proverbial feet, Costco should enjoy a return to stronger store traffic and revenue growth. Costco's first-quarter 2023 report showed the slowest year-over-year sales growth since 2016. With razor-thin profit margins on most goods, supported by a highly profitable membership program, Costco's financial results spring directly from popularity.

So anything that inspires consumers to sign up for a Costco membership should be good news for the company. Now, it's true that the company experienced a Costco-sized membership jump in 2020 as people explored making fewer shopping trips to buy everyday necessities in bulk at lower prices. From that perspective, more money in consumer wallets could be more of a challenge than a boon. At the same time, Costco's wide assortment of higher-priced items such as big-screen TVs and home appliances should provide fresh bait when the economy is moving in the opposite direction, too.

So, whether it's a bulk pack of toilet paper or the latest home entertainment system, Costco's diverse offerings position it well to capitalize on economic recovery. I think it's fair to say that Costco thrives on change, and we should have plenty of that coming our way in the next couple of years.

2. Benefits earned from lessons learned in hard times

Adjusting to the coronavirus era's ebbs, flows, and unique attributes has changed how Costco runs its business. Home delivery shopping and the e-commerce portal have become cornerstones of the business. Generally speaking, every retailer had to optimize their operating efficiency in recent years, and Costco was no exception.

As a result, Costco's operating and net profit margins are soaring near all-time highs:

COST Operating Margin (TTM) Chart

COST Operating Margin (TTM) data by YCharts

The lessons learned in this challenging period should benefit Costco for many years to come. I expect the operating margin to stay above 3% in three years, and the net margin could hold steady at 2.3% or more. Both would be comfortably above Costco's long-term averages, setting the stage for richer bottom-line profits and rising shareholder value.

3. Gas sales will start to fade

The third secular shift is trickier, since it brings both headwinds and tailwinds for Costco's total business.

Gas-powered cars will still be legal and ubiquitous for the next decade or so. States like California, New York, and Maryland have already committed to banning the sale of new gasoline vehicles by 2035. At this point, you can't stop the onrush of electric cars but it'll take many years to see real change to the carbon-based fuel infrastructure.

But change is coming, and Costco needs to prepare for it. The company's low-cost gas fillups provide an important boost to the warehouse foot traffic. In a gas-less world, there will be one less reason to visit Costco.

At the same time, the gas pumps offer some of Costco's skinniest operating profits. Letting go of that idea may be bad news for the top line but it should actually result in another boost to the company's overall profit margins.

Electric cars are coming, but they account for less than 1% of vehicles on American roads in 2023. But more than half of the new models in 2026 could be electric and hybrid, according to an in-depth market study by Bank of America analysts. In other words, the balance between battery systems and gas-guzzlers should shift by a significant degree within my three-year analysis period.

And that means Costco will have to figure out how to overcome the slow, gradual loss of an important store traffic booster. I believe this is the key item to watch for long-term Costco investors.