How to set WiFi username and password if it's not already hard-coded?

I have a Wemos D1 (ESP8266). It works great to control a relay from the internet, but I have to hard-code the WiFi’s username and password into the Wemos first.

If this were a consumer product, the username and password would need to be set some other way, so what’s the strategy?

Wire the Wemos with a bluetooth module and try and have the user connect to the Bluetooth module first and have them submit their username and password through an app, through bluetooth, to the bluetooth module, which somehow updates the internal code of the Wemos with the WiFi username and password?

When there is no known network near, the WeMos can start in AP (access point) mode.
There you can have a web page that allows you to change/add/store new network settings.
I think most of it is explained in this article.
Also watch some of the Andreas Spiess videos on Youtube.
I think this page explains what you're after.

I've got a little track bot that gets controlled over WiFi and I keep the ssid and password in EEPROM. Sometimes I like to show him off at someone else's house and I have a little switch that tells the code on startup to stop and ask for a different ssid and password over the serial line.

The ESP can have a shipload of SSID/PW stored in it's own flash memory.
And automatically switch to the network with the strongest signal (ESP8266WiFiMulti).
Explained in the first article.

I use WiFiManager which makes the ESP behave like consumer WiFi devices.

Yup, WiFiManager is the best! With WiFiManager, if your ESP either doesn’t have stored WiFi credentials or it can’t connect to the saved WiFi (like if you take it to your friend’s house), it will start up an access point and serve a web page at with nice buttons where you can either scan available networks and enter password, or enter SSID/password without scanning. Very nice tool, I highly recommend it.

Wow, that's so kick ass!