The wifi module it is in the logic board but it's very very dificult to replace you may need a very high electronic technical skills to do it,try checkin the wifi antenna conector, also reset all setting trough settings/genereal/reset, if you have jailbroken your iPhone trough thisrd party software some times this action grayout wifi service, findout some forums to fix this issue.