Starbucks plans to eliminate food waste and donate all of its unused food items from its U.S. stores to the needy within five years.

The coffee chain announced Wednesday it will partner with an agency called Food Donation Connection to expand on an existing project. Since 2010, Starbucks has been collecting pastries at the company's 7,600 stores after they can no longer be sold to customers, and working with FDC to get them to food banks and homeless shelters where they can be consumed.

The new plan expands on that to include perishable items such as breakfast sandwiches, salads, and other ready-to-eat meal packages.

The company said it will add up to five million meals in its first year, and more than 50 million free meals by 2021.

The idea came from the chain's employees, Starbucks said, as the front-line staff are most keenly aware of how much unsold food gets wasted at the end of every day.

"When we thought about our vast store footprint across the U.S. and the impact we could make, it put a fire under us to figure out how to donate this food instead of throwing it away," spokeswoman Jane Maly said. "The challenge was finding a way to preserve the food's quality during delivery. We focused on maintaining the temperature, texture and flavour of the surplus food, so when it reached a person in need, they could safely enjoy it."

The program basically boils down to a fleet of refrigerated trucks that will visit all of the chain's U.S. stores periodically through the day, to collect any items that haven't been or won't be sold, but are still edible. 

Starbucks said it hopes other food sellers will join the program, which would lower costs for everyone through economies of scale. 

Hunger relief non-profit agency Feeding America, which administers the truck program, estimates that roughly 30 billion kilograms of food goes to waste in America every year.

Food consultancy Value Chain Management International Inc. estimates that roughly $31 billion worth of food is wasted in Canada every year.

Canadian Starbucks locations will not be included in the program, but a spokesperson told CBC News Wednesday the chain here is watching closely.

"In Canada we currently have measures in place to donate unused food and are working to formalize the practices so that we can maximize our efforts in this market," Madeleine Löwenborg-Frick said. We are learning from the rollout of the program in the US. and are currently exploring the best way to expand this program in the most local relevant way."

The program is reminiscent of a recent French law passed last summer that will require all supermarkets to donate unused food items to charities or to farms for use as animal feed or compost.