The charging port connection is not properly connected. Look on YouTube for video on disassembly and push down the charge
connector and clean battery connection and charge port with electronic cleaner and test it before putting the back case back on to make sure it works. That is what fixed mine. Others replace battery, and I don't think that's the problem. It's just a bad connection.