FULTON, N.Y. — The procession started in toys, marched through electronics, down into grocery and past the registers at the front end.

Fifty-one men and women, dressed in shimmering blue and yellow caps and gowns, walked through the Walmart to receive certificates on a stage set up in the store’s lawn and garden department. A bagpiper, wearing a kilt, led the graduates through the aisles.

For Roy Walts, it was the first time he had ever graduated from anything.

He dropped out of school in the ninth grade after his father died of cancer and his stepmother told him to leave the house. At 15, he lived in a Salvation Army clothing collection box. One Christmas night he ate cookies from a Dumpster.

So as Mr. Walts, 53, crossed the stage that April morning in front of the local mayor; Walmart’s regional manager for upstate New York; and his son, who had worked overnight stocking freezers, he had butterflies in his stomach.