It's a rough time to be a grocery store, with competition from new rivals squeezing margins on all sides.

But it's a killer time to be a grocery store shopper: They've never had so many companies vie to offer the lowest price.

The expansion of foreign discount stores Aldi and Lidl — the latter of which just opened its first U.S. stores last week — are challenging traditional grocery stores on cost, with prices that beat those in  existing U.S. stores by 20 to 30 percent, on average. On top of that, Amazon’s recent announcement that it plans to acquire organic giant Whole Foods threatens to take a bite out of grocers’ high-end business. (Amazon’s founder and owner, Jeffrey P. Bezos, also owns The Washington Post.)

To stave off the new competitors, chains like Walmart, Kroger and Albertson’s may have to make significant changes.

“Prices will go lower — that’s for sure,” said Daniel Lucht, the global research director at ResearchFarm, a British retail consultancy. “There will be lots of promotions, lots of special offers, lots of brands being pulled in, as well. This will be a great year for consumers.”

In some parts of the country, that great year has already begun — particularly where Lidl and Aldi have moved in. The two chains, both of which are German-owned, offer a limited selection of produce and packaged foods in relatively small, no-frills stores. That narrow focus has allowed them to optimize their supply chains and offer prices well below those of mainstream grocers.

A recent analysis by RBC Capital Markets, which compared Lidl sale fliers with those of other stores, found that its prices were about 22 percent cheaper than Food Lion's and 20 percent cheaper than Kroger's. Scott Mushkin, an analyst with Wolfe Research, has said that Aldi products typically cost about 20 percent less than Walmart’s. For brand-name products — think Coca-Cola or Oreos — analysts have found as much as a 200 percent gap between Aldi-bought products and mainstream-grocery-bought ones.

Historically, that hasn’t posed an existential threat to mainstream U.S. stores. Aldi has been in the United States for 40 years, for instance, and still represents a tiny portion of sales by volume.

On June 12, however, the company announced plans to spend $3.4 billion over the next five years to open an additional 900 locations, which will make it the third-largest grocer in the U.S. At the same time, Lidl plans to have 100 U.S. stores by this time next year, and analysts are predicting that within five years it could have as many as 600.

Conventional grocers have taken notice, spending millions of dollars on improvements to existing stores and developing new formats that emphasize offerings the discounters don’t have, such as prepared foods, coffee shops and pharmacies.

Many have also begun aggressive pushes to lower their prices relative Lidl and Aldi.

“That is probably the most immediate effect you’re going to see,” said Bill Urda, a retail analyst at the Boston Consulting Group. “There are many factors that go into customer loyalty, but price is always up there.”

To wit, Walmart, the country’s largest seller of groceries, embarked on a three-year, multibillion-dollar plan in February 2016 to lower its prices. While the company would not elaborate on the details of that project, citing competitive interests, Reuters reported that Walmart significantly dropped its prices in more than 1,200 North Carolina and Midwestern stores earlier this year. In the cities where Walmart was running the price experiment, Reuters found, a basket of its products cost 8 percent less than their Aldi equivalents.

The company has also been in talks with thousands of its suppliers to reduce costs. Phillip Keene, a spokesman for the company, said its price reductions intensified this year and will continue into 2018.

“We welcome competition because it makes us stronger,” Keene said in a statement.

Other stores are expected to take similar steps to keep in line with both Walmart and the new discounters. Mushkin, of Wolfe Research, has estimated that Kroger will spend $450 million this year to keep its prices in line with Walmart’s.

The company declined to expand further on its plans, and neither Albertson’s nor Kroger responded to the Post’s request for comment. But it’s easy to see how this will play out, said Lucht, particularly if they follow the model that’s been perfected by years of competition in Europe.

Unable to compete on price across the board, most stores will try to drop the prices of consumer essentials, such as milk and bread, and aggressively promote sales and deals on brand-name products. They may also expand their lines of in-house, private-label products or reformulate them to bring quality on par with competitors’.

In a June 15 webinar for mainstream grocers, Brick Meets Click, a prominent industry consulting firm, warned stores that they “will have to learn quickly or experience significant losses.” The number one way stores can compete, the webinar continues, is by “blunting” discounter’s price advantage.

That can be difficult for traditional stores though, Lucht said. If Kroger drops the price of its eggs to compete with Aldi, Aldi can drop the price of its eggs even lower. In the event of a price war, the discounter has a distinct advantage, in that its overheard and logistics are already far lower.

“Everything we do — from the size of our stores and the number of items we carry to the quality controls we have in place — is designed to keep shoppers’ costs down,” said Scott Patton, the vice president of corporate buying for ALDI US, in a statement to The Post. “We are able to deliver everyday low prices other retailers simply can’t match.”

When you see these low prices, of course, may depend on where you live. Right now, price competition is fiercest in the Mid-Atlantic, where both Lidl and Aldi now have a presence. In markets where these stores don’t exist yet, change may come slower. Howard Elitzak, an agricultural economist who tracks food prices at the Department of Agriculture, points out that Walmart, Kroger and Albertson’s still dominate the national market.

“I would anticipate that this situation will hold for the foreseeable future,” he said.

Still, there’s little doubt that the industry is changing — and at an unprecedented pace. Only 24 hours after Lidl opened its first U.S. stores, Amazon announced its intention to acquire Whole Foods, the country’s largest seller of organic groceries.

Although it’s unclear what Amazon intends for Whole Foods, analysts agree that it will only exacerbate the pressure on traditional grocery stores. Initially, there will be pressure on stores to improve their delivery and digital operations, said Urda, the BCG analyst. Eventually, Amazon’s Whole Foods will also put downward pressure on food prices, as it has with products as diverse as sports bras and books.

“You’re about to see the best operators in the country, if not the world, butt heads,” Urda said. “There will always be losers. But the consumer wins.”

Read more:

The simple mistake people make when they try to eat healthy