When the Giants closed their training camp and sent their remaining players and staff home, they had plenty of leftover food that could have gone to waste.

Instead of dumping it, they donated it to Scottsdale-area veterans, who in turn donated portions to other veterans’ groups around Arizona.

It was a win-win. Actually, a win-win-win.

The Giants and their vending company, Delaware North, won by donating perishables that weren’t going to stay fresh, and the local Veterans of Foreign War unit won as the beneficiary.

“Here we are in trying times. Every day’s a new day, and we have no idea what tomorrow’s going to bring,” said Jeff Jones, the commander at the VFW’s Scottsdale Post 3513. “You have three organizations that were able to form a unique partnership to provide something back to the community in a completely unexpected way.”

The spread of the coronavirus prompted Major League Baseball on March 12 to cancel spring training and suspend the season. On Thursday, days after team members were encouraged to go home, Giants president of baseball operations Farhan Zaidi said the training facilities in Scottsdale were shutting down.

The Giants had 10 Cactus League exhibition games that weren’t played, including six at Scottsdale Stadium. Mounds of food had been purchased for the players, not to mention ballpark food for the fans, but people weren’t around to consume it.

Some of it was packed away and some stored in freezers, but much of it was perishable, including fruits, vegetables and dairy products.

“We had purchased food for hundreds of people for a week,” said Leron Sarig, the Giants’ director of performance nutrition. “When we found out the facility was going to shut down, everybody thought, ‘Let’s just donate the food.’

“It was kind of a group effort. It’s awesome to be able to help people who probably need it more than we do right now.”

Although several Giants employees thought of donating the food, Jones, acting independently, contacted an associate who’s both a Scottsdale Post 3513 member and Delaware North employee, to solicit the idea of a donation.

The vending company’s general manager, Walt Farris, agreed with the idea and connected with the Giants. The next thing Jones knew, he was using his full-size pickup truck to transport the first five loads of food to the VFW meeting hall Wednesday and Friday (with more to come), a short drive south of the ballpark.

“We were able to stack all the food on tables and told the veterans, ‘Come take what you want,’” Jones said. “The supermarket shelves are going bare, and you can’t always get milk, bread and eggs. ‘Here’s a bag, here’s a box, take whatever you need.’”

Unlike other places around town and the country, Jones said, there were no hoarders grabbing more stuff than they need. “Everyone’s been extremely respectful and thankful for what we’ve been able to accomplish through this.”

Jones estimated the Giants donated food worth nearly $1,900, Delaware North another $1,500.

“The dollar value is irrelevant,” Jones said. “The relief we were able to bring to the community and the people who need it, that’s invaluable. It’s really good, especially in these trying times, to give back to the community. It’s an amazing feeling.

“We had everything from juices to sodas, produce, bread, cheeses, eggs, yogurts, taco meat, tortillas, shelf-sustainable milk, which is good for veterans with small kids who need that Vitamin D input. It’s like a little food bank.”

Jones reached out to other veterans’ organizations from outside Scottsdale to offer food to needy families.

Farris said his company is also the vendor for three other Cactus League teams — Dodgers, White Sox and Brewers — and has a history of donating products to various outlets.

Similarly, the A’s donated thousands of dollars of food to Waste Not, an organization in Arizona that collects excess perishables from various food suppliers and delivers to various agencies.

John Shea covers the Giants for The San Francisco Chronicle. Email: jshea@sfchronicle.com Twitter: @JohnSheaHey