I had this issue in Samsung J7 Prime and here's how I resolved it.
Go to Settings and Application Manager. Make sure "All Apps" are displayed. Locate the Settings app, click it and Force Stop it. It will start automatically again, and WiFi worked for me.
Note that Settings app is system settings...