Walmart will pay $5.6 million as part of a settlement in a consumer protection lawsuit that alleged the retailer overcharged its customers.

The Arkansas-based company is accused of overcharging customers and selling products, such as produce, baked goods and other prepared items with less weight than shown on the label, according to the Santa Clara County District Attorney's Office in California.

The civil complaint, filed by four California counties, also alleged that the retailer unlawfully charged customers prices higher than their lowest advertised or posted price.

The Santa Clara's District Attorney's office said Walmart's actions violate California’s False Advertising and Unfair Competition Laws.

"When someone brings an item to the register to be scanned, the price must be right," District Attorney Jeff Rosen said in a statement. "They expect it. California expects it. My office expects it – and we will apply the law to make sure of it."

Walmart previously accused of overcharging consumers

In 2012, Walmart agreed to pay $2.1 million for overcharging consumers in violation of a 2008 court judgment, according to a statement released by the California Department of Justice.

"Consumers who were overcharged at the cash register should have immediately received $3 off the lowest advertised price of the item. If the price was less than $3, the item was to be given to the consumer for free," based on a statement released by the then state's Attorney General and former Vice President Kamala Harris in 2012.

This article originally appeared on USA TODAY: Walmart to pay $5.6 million as part of settlement for overcharging customers

Reporting by Sara Chernikoff, USA TODAY / USA TODAY

USA TODAY Network via Reuters Connect