Sunan Ibn Majah, Book 25, Hadith 24 (Ibn Majah 2907)

It was narrated from Abu Ghawth bin Husain – a man from Furu’ – that he consulted the Prophet (ﷺ) about a Hajj that his father owed, but he had died and had not gone for Hajj. The Prophet (ﷺ) said:

“Perform Hajj on behalf of your father.” And the Prophet (ﷺ) said: “The same applies to fasting in fulfillment of a vow – it should be made up for.”