Chickens got some good news today. McDonald's, which buys about 2 billion eggs each year in the U.S., is switching entirely to the cage-free variety for all its restaurants in the U.S. and Canada, the company said. It will take about 10 years to make the switch entirely to cage-free eggs.

The announcement comes one week after the fast-food chain—which has experienced slumping sales—said it will start selling some breakfast items all day. That has meant the company will need to buy more eggs, a move that might worsen America's current egg shortage, some analysts say.

Already, McDonald's buys slightly more than 4 percent of the 43.5 billion eggs produced in the U.S. each year, according to The New York Times.

"Our customers are increasingly interested in knowing more about their food and where it comes from," McDonald's USA President Mike Andres said in a statement. "Our decision to source only cage-free eggs reinforces the focus we place on food quality and our menu to meet and exceed our customers' expectations.

McDonald's decision to buy cage-free eggs also dovetails with its mission to recast itself for millennial consumers, who are demanding more transparency around their food. In response, the fast-food giant introduced an advertising campaign last year that answers questions like what's really in a Chicken McNugget.

Those efforts hit a bit of a snag in August, however, when an animal welfare group captured video of workers at a farm that provides chicken for the McNuggets beating chickens using a stick with a large spike attached to it. McDonald's chicken supplier Tyson Foods quickly cut ties with the farm.

Follow Delish on Instagram.