Sounds definitely like a router or related issue. If I understood right:
You used to use cable and everything worked fine.
You switched to Wifi and it stopped working
But then it works if you don’t have your laptop charger plugged.
But it doesn’t work if you plug in your laptop charger?
if so, it really sounds like a some sort of interference issue from the charger, or electricity outlet the charger is plugged in or possibly from the laptop itself when the charger is plugged in.
Have you tried using a different charger? Or different electricity outlet for the charger? Or if possible another laptop with the charger and the current router?
As for suggestions, you could see if you can adjust the wifi settings to a different channel in case it automatically picks some congested one or one where the charger causes interference.
Alternatively, if you are using 2.4 GHz Wifi try to switch to 5 Ghz and other way around and see if that helps.