This same problem happened to me. I have an S6 Edge Plus I always get my phone to around 50% and unplug it at night so it isn't charging in spurts after it gets to 100%. Four days ago I woke up and tried to plug it in only to find that my charger wasn't registering at all, much less the fast charger. And yes, I have multiple fast chargers.
After trying to get it to work, checking every connection(wall, usb, micro usb), my phone started constantly switching between charging and not charging, even when I would unplug the cable. It didn't quit doing it until my phone shut off like 2 minutes later.
Once the phone cut off, I plugged the cable back in, and it registered the charger, and the charger stayed registered when the phone came back on. This wasn't without problems as it wasn't fast charging and said 5 hours until fully charged from 32%, which is slow for regular chargers.
I didn't have 5 hours so I turned my phone off and let it charge until it was around 45%, which took a little over an hour. By the end of the day, I only had 5 percent, and my charger wasn't registering again, so I turned my phone off and it registered again. This time, I turned my phone back on and came to this site to troubleshoot, and found no useful information lol. I factory reset my phone, put it in safe mode, tried emergency mode, airplane mode, and still nothing.
I ended up keeping it in airplane mode with all apps turned off and let it charge all night. It was 100% in the morning and I let it the battery completely drain until the phone cut off. After charging the phone again really really slowly the next night, I plugged my phone in again at around 57% battery and it started fast charging.
While this took multiple days, my phone is now fast charging again, so if you're out of warranty or can't get it replaced for whatever reason, I'd try charging it to 100%, letting it drain, and then charging it all the way back up. Turn the phone off if that's the only way it gains charge, I had to have it in airplane mode before it would go up.
Supposedly this resets the battery, or does some other mumbo jumbo, I'm not really a tech guy, but I didn't have to replace my 2 week old phone.