Chosen Solution

IPhone 7 once won’t stay on without the being on the charger and the battery is 100%

Restoring through iTunes and setting up as a new device is what tells us if it’s hardware or software. It’s possible that the battery itself is fine but the contacts or something aren’t connecting right. The best I can suggest is shell out for a battery replacement if you iPhone 7 is out of warranty and see if that resolves the issue.