A lot of times in movies and other media soldiers in WW2 or other wars during that time or before fire their weapons from the hip. Was this as common as it is portrayed to have been?

by ImitationFire
Panzerkatzen

Yes and no. It was used in some circumstances, but in general soldiers were trained and encouraged to use their sights. One example of this use would be in close quarters when you don't have as much time or room to aim properly. Another example would be to just provide suppressive fire, with less intention to hurt the enemy and more intention to keep him down.

During World War I, the Machine Gun was the undoubted champion of suppressive fire, but it wasn't very mobile. Though lighter weapons were invented, they were often too cumbersome to fire from the shoulder, new tactics were devised to maximize their effectiveness. One of the early prevailing concepts was Walking Fire, in which a group of soldiers would march forward firing from the hip in the enemy's direction. This was most effective when employing automatic weapons, and was developed in-part because it was easier to brace a machine gun at your hip. While you were unlikely to hit anything, the high volume of fire and approaching soldiers would often force enemy units to retreat, and if not they would be forced to fight in close quarters. A major downside to this was a well entrenched enemy could wait for the soldiers to march into their kill zone, then return fire while they're on open ground. The tactic was employed in both World Wars, but fell out of use as infantry tactics continued to evolve and weaponry became lighter and more mobile.

During World War 2, German Machine Gunners also employed a similar tactic called Sturmfeuer, or "Assault Fire". Similar to Walking Fire, to employ Sturmfeuer you would brace yourself while holding an MG 34 or MG 42 from your hip, and fire it at the enemy. Unlike Walking Fire, you weren't meant to march toward the enemy while shooting. It was not the choice tactic, but a stop-gap meant to be used when you could not properly deploy the Machine Gun, such as during an ambush where you wouldn't have time, or in tall grass where you would be too low to see anything. Whenever possible, the preferred method was still deploying the machine gun on a bipod or tripod. Here is a gif of a German soldier using the tactic.

CChippy

It depends on the weapon and the range. In the Australian Army, doctrine and training for the Owen Machine Carbine ("Owen Gun"), a submachine gun used in conflicts from WW2 to the end of the Vietnam War, was to fire immediately from the hip if coming into immediate contact at ranges up to 25 yards or to provide immediate suppressive fire. The Owen Gun had a top mounted magazine, which was aligned with the target as an aiming aid. Basic qualification on the weapon required a soldier to consistently hit a man sized target at 25 yards when firing from the hip, Beyond that range sighted shots were to be used. The Owen was replaced by the F1 which also had a top mounted magazine and had similar doctrine and training.