A man said to the Prophet ﷺ, "My mother died suddenly and I thought that if she had lived she would have given alms. So, if I give alms now on her behalf, will she get the reward?" The Prophet ﷺ replied in the affirmative. (Using translation from Bukhārī 1388)
لِلنَّبِيِّ ﷺ إِنَّ أُمِّي افْتُلِتَتْ نَفْسُهَا وَأَظُنُّهَا لَوْ تَكَلَّمَتْ تَصَدَّقَتْ فَهَلْ لَهَا أَجْرٌ إِنْ أَتَصَدَّقْ عَنْهَا؟ قَالَ نَعَمْ