This will help you
[link|https://howtofixgadgets.com/iphone-charging-port-not-working-fix-charging-port-iphone/|https://howtofixgadgets.com/iphone-charging-port-not-working-fix-charging-port-iphone/|new_window=true]
I was also having the issue but i got a solution, That’s to clean my charging port i cleaned it with a brush and now my problem is thankfully solved. In apple charging port replacement cost is 10 - 20 dollars.