I seriously don't think it's the battery that's causing this issue. It's definitely software, my iPhone 6S only started randomly shutting off after I had installed iOS 10. Apple don't know how to fix it, that's why they're replacing batteries. Convenient that this problem only began after the iPhone 7 came out.
I'm sick to death of this, can't even book an appointment to get the battery replaced because none seem to ever be available. 3 calls to Apple and have gotten nowhere.
Some people have reported this problem on iOS 9.3....