Chosen Solution

Hello guys ! So here is my issue: my iPhone 7 won’t charge anymore and it’s not recognize by my computer. Of course I tried differents cables and power sources, I replaced the battery (by an old one, for testing) and I replaced the lightning port but still nothing ! Where does the problem can come from ?? Thanks for your help. edit: I’m able to listen to music with headphones so the lightning port itself works

Since you have ruled out parts the problem would be a faulty charging component. Since it is not recognised by your PC the component that needs replacing would be the Tristar IC. This repair has to be done by a reputable repairer and is not something you can attempt yourself unless you have the right equipment and skills.