Causes
Unplug the charging cord from the laptop and the power outlet. Then, make sure to firmly reconnect the power adapter to the wall outlet and the laptop's charging port. The plug should not wiggle or feel loose. If your laptop uses a detachable power brick, check that the cable between the brick and the wall plug is also secure.
The issue could be the wall outlet itself. Try unplugging the cord from the wall and connect it to a different outlet in another room or on a different circuit. You could also check the wall outlet by plugging in a different device to see if it charges. If the outlet doesn't charge either device, then avoid using it and contact an electrician.
If everything else previously stated fails to work, the motherboard may be the problem. The motherboard is the component that controls power delivery to the laptop. A damaged motherboard can stop the battery from charging even with a working charger and battery. See the Motherboard replacement guide.