Cleaning the toilets is quite likely what a kid who steals stuff all the time may end up doing after school, so in a way this would act as a reality check for him. But on the other hand, I'm not sure if it's a hygienic punishment for a child to be given. Quite likely, it is in breach of government regulations to do this to him.
I'd also like to point out that the child's age does make a huge difference on the validity and justice of the punishment, so it should be in the OP.
Not only that, but it IS an extreme punishment for the simple act of stealing a can of drink. There's even syndromes for this which he could potentially be diagnosed as having, such as kleptomania, and these tend to reduce the severity of thievery charges in many different countries. For a good reason as well.
Let the punishment fit the crime - I'd say that if the school really has to be the system that punishes him, make him clean the cafeteria in the school, after hours if he wishes, and save the cleaning lady some work there. That way, it's slightly less humiliating, definitely more hygienic, and also somewhat of a reminder of where he stole the item from. If he steals something from there while on the job, that's when I'd be saying either it's kleptomania or just a kid who needs to clean toilets.