The Kroger supermarket chain's Cincinnati headquarters. (Lisa Baertlein/Reuters)

Kroger followed Walmart in asking customers not to display their firearms in stores located in “open carry” states, becoming the latest big chain to reshape its business around gun reform amid a spate of mass shootings.

The nation’s two biggest grocers also are pushing for tougher background checks, bowing to public pressure that has been building since deadly shootings at Walmart stores in El Paso and Southaven, Miss., claimed 24 lives and wounded dozens this summer.

“Kroger is respectfully asking that customers no longer openly carry firearms into our stores, other than authorized law enforcement officers,” Jessica Adelman, group vice president of corporate affairs, said in a statement to CNBC on Tuesday. “We are also joining those encouraging our elected leaders to pass laws that will strengthen background checks and remove weapons from those who have been found to pose a risk for violence.”

Only California, Florida, Illinois and the District generally bar people from openly carrying guns in public. The rest of the country allows some form of open carrying, but standards — including whether a license is needed or what kind of firearms are allowed to be openly carried — vary from state to state. Often, there are exceptions to open-carry laws for certain locations, such as schools or public transportation.

The announcement came hours after Walmart’s. But the Bentonville, Ark.-based retailer went further, saying it would stop selling ammunition for military-style weapons and complete its exit from the handgun business. The company had been under pressure from gun-control advocacy groups, politicians and its own employees since the two store shootings. Roughly 40 white-collar workers in California walked off the job to protest Walmart’s gun policies last month, and e-commerce workers in Portland, Ore., and Brooklyn urged the company to stop selling firearms and organized a Change.org petition, which has since garnered more than 140,000 signatures.

“In a complex situation lacking a simple solution, we are trying to take constructive steps to reduce the risk that events like these will happen again,” Walmart chief executive Doug McMillon said in a memo to employees on Tuesday. “The status quo is unacceptable.”

The decision was a blow to gun rights advocates, some of whom had been showing up at Walmart locations carrying guns on their hips in the hope that the retailer would not shift its policies.

Walmart sells guns in about half of its 4,750 U.S. stores but stopped selling military-style rifles favored by mass shooters in 2015. But until now, it made up about 20 percent of the ammunition market. Now, that share could fall to as little as 6 percent, the company said. Walmart will continue selling long-barrel deer rifles and shotguns, as well as other firearms and ammunition for hunting and sports shooting,

In the wake of the 2018 school shooting in Parkland, Fla., that killed 17 people, Kroger announced it would stop selling guns to customers younger than 21 at the company’s Fred Meyer grocery stores in the Pacific Northwest, then decided to stop selling guns and ammunition altogether. Dick’s Sporting Goods also banned sales of assault weapons in its stores after Parkland.

“A year ago, Kroger made the conscious decision to completely exit the firearm and ammunition business when we stopped selling them in our Fred Meyer stores in the Pacific Northwest,” Adelman said in the statement to CNBC. “Kroger has demonstrated with our actions that we recognize the growing chorus of Americans who are no longer comfortable with the status quo and who are advocating for concrete and common sense gun reforms.”

Cincinnati-based Kroger is the second-largest grocer in the United States and counts Harris Teeter and Mariano’s among its many brands. It operates nearly 2,800 grocery stores in 35 states, many of which also include on-site pharmacy and jewelry stores.