Shaving cream is a soft soapy substance which men put on their face before they shave. Therefore, the soapy substance will definitely irritate eyes and make your eyes get hurt.But don't worry, i am willing to help you get rid of this situation. At first, if you don't feel very uncomfortable, you can deal with it by yourself except rub your eyes with your hands. Second, wash the eyes with a large amount of clean water to make sure it drain out of your eyes with flowing water. Next, use several droplets of anti-inflammatory eye drops.However, if the situation is serious, you are supposed to go to hospital to have a professional eye check as soon as possible.