Macbook Pro keeps shutting down even when magsafe is plugged
This could be a Hardware issue. 

But you have these options that can help: 

1) Reset your Mac's NVRAM or PRAM.

2) If you continuing experiences issues, try to reset the SMC of your Mac.

I hope that works.