It is narrated from Ata that he said: The Prophet ﷺ heard a man saying, "I am present on behalf of so-and-so." So the Prophet ﷺ said to him: "If you have performed Hajj before, then recite the Talbiyah on his behalf; if not, then first perform Hajj for yourself, then fulfill it on his behalf."
Hadith Referenceمسند الإمام الشافعي / كتاب الحج / 923