If in warranty it will be covered. As long as there's no damage to device.
This issue is actually common and requires a new charging port or battery.
Both of these hardware have sensors on them monitoring the temperature before charging. And will need replacing
Book in with Samsung for a repair