Determining whether this is an issue with either the controller, the charging cable, or even the console's charging port is the first action needing to be taken.
If you already have an additional controller, try that out to see if the cable charges it. If that also isn't charging, clean the console's charging port in the event there's dust build-up. And if neither of those actions yield results, buying a new cable would be the last simple means to solve the problem.