i had this issue with my macbook air early 2015 edition 13 inch, it would turn off if i unplugged it and tried to run on the battery, went to ifixit.com bought a new battery and problem solved
open