Walmart said Tuesday that it would discontinue the sale of ammunition used in high-capacity magazines and military-style weapons and also asked its customers not to openly carry firearms in stores even in states where it is permitted.

The news follows mass shootings across the country, including 22 people who were killed last month in a Walmart and the surrounding area in El Paso, Texas.

In July, a "disgruntled" Walmart employee in Mississippi killed two colleagues and wounded a responding officer.

The retail giant said it will stop selling short-barrel rifle ammunition, such as the .223 and 5.56 caliber, which can be used in high-capacity magazines and military-style weapons, CEO Doug McMillon said in a memo.

Guns for sale at a Walmart on July 19, 2000. Newsmakers / Getty Images

"We’ve also been listening to a lot of people inside and outside our company as we think about the role we can play in helping to make the country safer. It’s clear to us that the status quo is unacceptable," he said.

In addition, Walmart will discontinue the sale of handgun ammunition and will ban the sale of handguns in Alaska, which was the last state the chain allowed them to be sold.

Presidential candidate Sen. Cory Booker, D-NJ, praised Walmart's decision, saying the company was doing the "right thing."

"When people work together and demand change, change can happen. This decision by Walmart only happened because employees and activists have been unrelenting in their fight to combat gun violence at every level," he said in a statement.

The nonprofit organization Everytown for Gun Safety, which advocates for gun control, said it applauds Walmart “for taking another significant step forward.”

Former Rep. Gabrielle Giffords applauded the company for "working to make its stores, staff, customers, and country safer."

Giffords was shot in the head and seriously wounded, along with 18 others, during a shooting in January 2011 at an outdoor constituent event in the Tucson area. Since then, she has advocated for tougher gun laws.

"I’m hopeful it will inspire elected leaders to follow in their footsteps," she continued.

Walmart said it will also ask shoppers to stop openly carrying weapons in open-carry states. McMillon told reports in a call Tuesday that he hopes "achieve a smooth transition" as stores ask customers to honor its news policy.

“We just hope customers will understand that it’s not an attempt to question their legal right," he said. "We know the vast majority of those will understand and adhere to the policies."

The company will still allow shoppers to purchase weapons, apparel, and ammunition used for hunting and sporting, including long barrel deer rifles and shotguns.