The Prophet ﷺ said: If anyone acquires knowledge that should be sought seeking the Face of Allah, but he acquires it only to get some worldly advantage, he will not experience the arf, i.e. the fragrance, of Paradise. (Using translation from Abū Dāʾūd 3664)
قَالَ رَسُولُ اللَّهِ ﷺ «مَنْ تَعَلَّمَ عِلْمًا مِمَّا يُبْتَغَى بِهِ وَجْهُ اللَّهِ لَا يَتَعَلَّمُهُ إِلَّا لَيُصِيبَ بِهِ غَرَضًا مِنَ الدُّنْيَا لَمْ يَجِدْ عَرْفَ الْجَنَّةِ يَوْمَ الْقِيَامَةِ»