All praise is due to Allah, and peace and blessings be upon our master, the Messenger of Allah ﷺ.
The scholars of fiqh are agreed that the buying and selling transactions of a young child who has not yet reached the age of discernment are invalid with regard to matters of significant value. Imam al-Māwardī ash-Shāfi‘ī (raḥimahullāh) said: "As for the young child [who lacks discernment], his purchase is invalid according to us, and it is not contingent upon the guardian's ratification [i.e., even ratification cannot validate it]." [al-Ḥāwī al-Kabīr, Vol.5/P.368]
The preferable approach with regard to young children who lack discernment is for the family to provide them directly with whatever food and drink they need when sending them to school, or for the guardians to arrange directly with the school administration to provide the children with what they need from the cafeteria/canteen.
That said, in cases where it is not feasible for the family to send food and drink with the child, or where arranging directly with the school administration is not possible, the Ḥanbalī scholars have held that the buying and selling transactions of a young child who lacks discernment are valid with regard to minor, insignificant items. Imam Ibn Qudāmah al-Ḥanbalī (raḥimahullāh) said: "As for the one who lacks discernment, his transactions are not valid, even if his guardian permits him — except in minor matters, as narrated regarding Abū ad-Dardā', who purchased a sparrow from a young child and then released it. This was mentioned by Ibn Abī Mūsā." [al-Mughnī,Vol.4/P.186]
Imam al-Mardāwī al-Ḥanbalī (raḥimahullāh) said: "The apparent wording of the author suggests that the transactions of one who lacks discernment are not valid under any circumstance. As for significant matters, they are decisively invalid, even if the guardian permits it. As for minor matters, the correct position within the madhhab is that his transaction is valid, and this is the correct view — affirmed decisively in al-Mughnī and ash-Sharḥ." [al-Inṣāf fī Ma‘rifat ar-Rājiḥ min al-Khilāf, Vol.4/P.268]
Accordingly: there is no Sharia objection to the buying and selling of minor, insignificant items and matters of little value by a young child who lacks discernment, provided this occurs with the guardian's permission and is in keeping with common custom ('urf). However, it remains preferable for the family to arrange directly with the school administration to provide the child with what he needs, or to send food and drink along with him. And Allah, the Exalted, knows best.