No, but I'm given to understand it significantly reduced the numbers lost to such. At first they tried generating permanent magnetic-neutral fields, but that cost too much (you needed a coil of copper for each ship), so they developed the degaussing process that would keep a ship mostly safe for a few months before it build up a signature again, which provided some margin of error.
Of course, if they get a few days of warning I wouldn't expect the British to hold back from doing the whole fleet, so those big minefields to be particularly troublesome.
The Germans used a mixture of mine types though ... not just magnetic ...
31st August 1940
The 20th Destroyer Flotilla, consisting of destroyers ESK, EXPRESS, IVANHOE, ICARUS and INTREPID departed the Humber escorted by destroyers KELVIN, JUPITER, VORTIGERN to lay minefield CBX.5 off Vlieland. The minesweeper SALAMANDER swept the Humber entrance before their departure.
At 22:50 an aircraft reported a large number of enemy vessels to the north of Terschelling steering west. The Destroyers were ordered to jettison their mines and attack the German vessels.
Forty miles northwest of Texel, the destroyer EXPRESS struck a mine damaging the ship and mortally wounding the Captain and killing 46 others. During the rescue mission the destroyers ESK and IVANHOE also struck mines, at 2325 and 0051 on 1 September, respectively.
The destroyer ESK was sunk outright by the mine explosion with only two crew from ESK being rescued by British ships and over 130 crew lost. The destroyer IVANHOE was badly damaged, but was able to proceed under her own power for a time.
The following morning the destroyers Jupiter and Kelvin went to search for the damaged ships whilst VORTIGERN was left to mark the safe gap in the minefield. The destroyers GARTH and HAMBLEDON were also sent. Minesweepers LEDA and SALTASH, tugs ST CYRUS, IRISHMAN, NORMAN, WHEELDON, motor torpedo boats MTB.29, MTB.30, MTB.31 went to assist destroyer EXPRESS.
In the meantime German aircraft had rescued over fifty British seamen from the sea who were transported back to Norway to become POW.
When the destroyer GARTH eventually found the IVANHOE it was decided the ship was so badly damaged that it could not be saved and was scuttled by a single torpedo fired by GARTH.
The destroyer EXPRESS was safely towed back to Hull and was repaired by 30 September 1941.
Fortunately this incident occurred in the waters of the North Sea with little or no German air cover. I dread to think what may have happened in a location (such as the Straits of Dover) where the German’s could have been on them within 15 minutes of sighting, where there were many hundreds of bombers and dive bombers sitting, waiting for the radar signal that would allow them to continually attack for hours.