In Ramadan, we performed the Taraaweeh prayer and bought our Sahoor (pre-dawn meal) and prepared it. Nevertheless, we slept and did not wake before dawn. Is that a valid intention, or is our fasting invalid?
All perfect praise be to Allah, the Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His Slave and Messenger.
Buying Sahoor and preparing it imply the intention of fasting the next day. Consequently, your fasting is valid, and the fact that you slept and did not eat Sahoor does not invalidate it.
Ibn Taymiyyah said, “The intention of fasting in Ramadan, according to the consensus of scholars, does not require one to say, ‘I am fasting tomorrow’; rather, it is enough to have the intention in his heart. The intention follows knowledge. When one knows what he wants to do, he must intend it. Consequently, when the Muslim knows that Ramadan will be from the next day and he is among those required to fast, he naturally intends fasting. Likewise, when he knows that ‘Eed will be the next day, he (by default) will intend - that night - not to fast.”
And Allah Knows best.