Walmart is responding to heightened concerns about underage use of tobacco by raising the purchase age in its Walmart and Sam's Club stores to 21.

The world's biggest retailer announced Wednesday that the age change will go into effect July 1 and includes e-cigarettes. It's also discontinuing the sale of fruit and dessert nicotine flavored e-cigarettes and vaping products.

The move is a reaction to an April 5 letter from the U.S. Food and Drug Administration telling Walmart that its policies failed to prevent products from being sold to minors.

"There's been a lot of discussion lately about how companies restrict the sales of tobacco to minors," said John Scudder, U.S. chief compliance and ethics officer for Walmart. "While we have implemented a robust compliance program, we are not satisfied with falling short of our company-wide goal of 100% compliance."

Earlier this year, the FDA threatened to fine a dozen retailers, including Walmart, Kroger and Family Dollar, for illegally selling tobacco products to children younger than 18. The agency said its inspections found that 17% of Walmart stores had sold tobacco to minors since 2010.

By comparison, 7-Eleven had a violation rate of 25%, compared with 38% at Exxon. Irving-based 7-Eleven didn't respond to a request for comment.

"These illegal sales must stop," the FDA said in its letter to Walmart. "Violating the law ... and paying associated fines and penalties, should not simply be viewed as a cost of doing business."

The changes will be felt broadly in Texas, which is Walmart's largest market. It operates 595 Walmart and Sam's Clubs in the state.

It also comes as the Texas Legislature reviews a bill that would raise the tobacco purchase limit from 18 to 21, but with an exemption for active military. There are 13 U.S. military installations in Texas.

The Legislature is also considering a 10% state retail excise tax on e-cigarette and vape tobacco products.

Kevin Burns, JUUL Labs chief executive officer, said in an email that he commends Walmart for raising the age limit for vapor products, adding that his company implemented a plan in November to stop the sale of non-tobacco flavored pods to traditional retail stores. The increase in age also helps fight one of the largest contributors to youth usage, Burns said, which happens when legal-age peers purchase for younger people.

"We are committed to preventing underage access to our products," Burns said.

States have often raised the tobacco purchase age to 21 after some of their cities did first, according to an analysis by TobaccoFreeKids.org. It said San Antonio, Kirby and Leon Valley are the only Texas cities to raise the minimum age.

States that have adopted the 21 purchase age are Arkansas, California, Delaware, Illinois, New Jersey, Massachusetts, Oregon, Hawaii, Maine, Utah, Washington and Virginia.

Among retailers, there's no one policy, but the FDA is trying to make them more aware of what's happening in their stores. In 2014, CVS was one of the first retailers to get out of the tobacco business.

Twitter: @MariaHalkias