Chosen Solution
my mac wont turn on while charger connected. Only powered on by removing the charger and after power on every thing works fine and battery is also charging fine no issues. And some times wont came out from sleep
I would follow apples guide it could be a PRAM reset or NVRAM reset https://support.apple.com/en-us/HT204267 It sounds like something is causing a short so you can try to replace the charging port itself before doing that and spending the money try apples guide then if that doesn’t work backup and do a factory reset.