When your water has an onion odor, the cause can either be the water or another contributing factor. Before taking steps to stop the odor, you need to determine if the water is the actual problem or if the smell is being caused by something else. You can easily test if this is the problem by catching some of the water in a jar or glass and taking it outside. If it smells fine when you are outside, then the problem is not with the water itself. If the water does smell, you should contact your water supplier to have the safety of the water tested.
If you have a clog in your garbage disposal or kitchen drain, this can cause your shower to smell like onions. What happens is that the water running to the shower can free the gas from the bacteria in the clog. The result is that you smell the gas coming out of the tap in the shower. If you want to stop this smell, you need to clean the drain out. Do this by flushing the drain and pouring in some bleach to sit overnight.
If you have been away from home, or have not used the water in some time, it can result in bad smells. What happens is that the pipes dry out and allow sewage odors in. To avoid this problem, turn on all the taps and let the water run for a few minutes after returning home. This will get all of the smell out before you get in the shower.
Your hot water heater may be to blame for the onion smell in your shower. If not used for a few days, the metal in the tank can cause the water to smell. This can also happen if you have the thermostat set at a temperature too high or too low. A hot water heater technician can assist you in getting the setting at a good place.