Is ice and water shield necessary to meet code?

I am a consumer, not a roofing contractor. I had a roofer tell me that ice and water shield was necessary on my entire roof to meet code. He said it was because my roof was just under a 4/12 pitch and I was using an architectural shingle. He also said if I did not use it over the entire roof that my warranty on the shingles would be void. Just curious is any of this is actually true.

Not true. I&S on the whole roof will also likely require the entire roof deck be removed and replaced new time the roof gets done to, fo double the ordinary cost.
Thought they say that using I&S means you don’t have to shorten the exposure, I still do it and run 4" to 4-1/2" exposure.

IRC requires a double layer of felt for installations involving roof slopes where the pitch is 2:12 to 4:12. Certainteed Landmark, as an example, requires either a double layer of felt underlayment or ice & water shield for installations where the pitch is 2:12 to 4:12. We avoid putting arches on roofs where the pitch is below 4:12.

I/W shield is the most over rated product on the market. They might say that the roof will leak without it due to being under a 4/12 slope but how long do you think a roof with water trapped between the shingles and the I/W shield will last?

For Residential work, shingle grain surfaced rubber membrane is the best solution for anything from a 1/2 and 12 to a 3/12 slope.