Unsold sandwiches and fruit and cheese boxes at Starbucks will soon be destined for somewhere besides the trash.

The coffee giant set a goal Tuesday to donate 100% of its unsold food still safe to eat from its 7,600 U.S. stores. Through partnerships with Food Donation Connection and the nonprofit Feeding America, perishable food will be picked up from Starbucks stores each day in refrigerated vans and redistributed to food banks. That includes breakfast sandwiches, paninis, salads and the company's "bistro boxes," prepackaged meals filled with snacks like vegetables and hummus, fruit and wraps that otherwise would have been thrown out.

Starbucks says the program, called FoodShare, will provide five million meals in the first year and nearly 50 million by 2021, when it expects to reach a 100% donation rate. Starbucks has already partnered with Food Donation Connection since 2010 to donate its surplus pastries.

For the expanded partnership, Starbucks had to figure out how to make sure fresh items would still be safe to eat by the time they reached needy individuals, which meant developing a process to keep the items cold enough while they wait to be picked up and transported to food banks.

"The challenge was finding a way to preserve the food’s quality during delivery," said Jane Maly, brand manager on the Starbucks Food team, in a company statement. "We focused on maintaining the temperature, texture and flavor of the surplus food, so when it reached a person in need, they could safely enjoy it."

Starbucks is hoping other restaurants will get on board and that it could eventually dispatch its refrigerated vans to other chains looking to divert food waste. The pledge is significant given a government goal set last year to cut food waste in half by 2030.

Feeding America estimates the country wastes 70 billion pounds of food every year. Meanwhile, millions of households are considered food insecure, defined as lacking "access to enough food for an active, healthy life for all household members," according to the U.S. Department of Agriculture, which says 17.4 million households were food insecure in 2014.