There are a lot of trained professionals who will think nothing about engaging an adversary with a full auto assault rifle if they have a pump or semi-auto shotgun. Some experienced urban police will fire the 12 gauge into the concrete a few feet in front of the adversary so that the buckshot with bounce off the cement into the feet and legs of the adversary causing them acute pain and impairing their ability to walk. This disables them enough for you to finish them off while they are screaming, limping or rolling on the ground or else you can capture them. Curiously the same can be done with a 9 MM full auto assault rifle. Shotguns can be fitted with special chokes to tighten their grouping out to 100 yards bringing the shotgun into a militarily significant range weapon.
There are other chokes often referred to as duck bill chokes that will horizontally spread the buck shot out so as to enable one to shoot two or even three adversaries with one shot of 00 buckshot. This turns the shotgun into an even more Telephone Number List deadly ambush and counter-ambush weapon. One can also get specialty shotgun ammo. This can be illegal in places. They have two large pieces of buckshot with a 12-inch piece of piano wire welded to each ball. This can cause the piano wire to cut a person badly when the balls spread especially their internal organs. Body armor would not work reliably on this ammo.
Other ammo causes the shotgun to turn into a flamethrower for about 2-3 seconds throwing fire out for about 40 feet. Imagine trying to breech a doorway and running into a wall of fire. There are slugs made of very soft lead that mushroom a lot to cause massive wound channels. There is ammo with spikes loaded into it. We could keep going the list is long for specialty shotgun ammo. Shotguns are a real headache for an occupying army.