The Duke and Duchess of Cambridge made lunch for young people who have been helped by the homelessness charity Centrepoint.
William, who has been a patron of the charity since 2005, and Kate helped prepare and serve soup and bread at Centrepoint's facility in Barnsley.
The couple chatted and joked with staff and young people during the visit, their first to South Yorkshire.
Earlier, the Duke and Duchess opened a new £50m McLaren factory in Rotherham.
The Royal couple were joined at the opening by the Crown Prince of Bahrain.
The McLaren plant at the Advanced Manufacturing Research Centre is set to create 200 jobs building carbon fibre chassis.
McLaren chief executive Mike Flewitt said the site "was more than simply a factory".
He said: "Although manufacturing is an important part, it's an innovation centre, a place where new technology will be developed."