What a clever child you have! He understands the shampoo is to be used in the bath, so he tried to take a bath in order to play with it. That is fabulous!
I do understand the problem, but I do think you should take a moment to recognize this problem is stemming from the fact that your child does understand what you have told him, each thing has a place where it gets used. Kids often don't seem to respond to the word, "not." It often seems like although you said, "they're not toys," they hear, "They're toys." Whenever possible, I try to use the opposite. Instead of saying something is not, I ask myself, okay what is it? and tell kids about that. I'd suggest teaching him that shampoo, soap, toothpaste etc. are tools. Each item has a job to do - even his toys have a job to do - to entertain and teach him. When he plays with his toys, his toys are doing their job. Shampoo, however, has a different job.
Shampoo does the job of washing hair and it also does this job at a specific time - not just when he feels like washing. I'm sure you are happy to teach him how to use the tool shampoo correctly, but stress to him that it should only be used when it is bathtime, not just "in the bath." Make it clear to him when "bathtime" actually occurs. Is it part of the bedtime routine? Is it something that happens every Tuesday, Thursday and Saturday? Does he bathe in the morning? Give it a specific time and even show him when that time is on the clock.
Same, of course, goes for other toiletries. Give him specific examples of the job the item helps in completing as well as when that job is done. Indicate that the when's you are giving are the only time to use those items. Then enforce the idea. Don't use the soap and shampoo as a toy any longer if you have been, in order to help make the distinction for him. After he is past this little phase, you can go back to an occasional playful moment with the soap. Good Luck!