True Value Co. heard from its more than 4,500 affiliated hardware stores last month that hand sanitizer was flying off the shelves, leaving store staff with none for themselves.

At the company’s factory in Cary, Ill., which makes cleaning products and paint, John Vanderpool, the company’s divisional vice president of paint, recalled asking, “What can we do to help here?” After a tip from his wife, a pharmacist, he consulted with the Food and Drug Administration, then huddled with his maintenance team and engineers over two...