You can try these things. Make sure to backup your data first. However it's most like going to need microsoldering to replace the wifi chip. Which in that case you'll want to send it off to a reputable board level repair shop
Reset iPhone Network Settings. Settings — General — Reset — Reset all Network Settings.
Erase all content and settings. Settings — General — Reset — Erase all content and settings.
Restore iPhone. Plug iPhone to Mac/PC, and then launch iTunes.