Trying to find instructions on how to reset the M15w printer to set up a new wifi connection was a nightmare. I eventually managed to piece together a solution with a combination of random forum posts, and a comment on a youtube video.
For future proofing, I’m writing down the instructions here. This is from the perspective as a Linux user, but since it’s all just hardware and networking you can likely do the same on any operating system.
Steps
Reset the printer (Turn off the printer, then press and hold the cancel button while turning it on again. Keep holding the cancel button for ~20 seconds.)
Print a debug page which should contain the default wifi password. Hold the cancel button for ~5 seconds to do this. You’ll find the password under Wifi-Direct Setup -> Wifi Direct Password:
Or just try 12345678 which seems to be a default.
Using the password you found, connect to the wifi network created by the printer. It will be named something like DIRECT-d9-HP M15 LaserJet.
Figure out the gateway address to connect to (in my case http://192.168.223.1/, most likely it will be the .1 address of your LAN ip)
Configure the connection to your regular wifi network from there. Networking tab -> Wireless Configuration.
Test the new setup by connecting to your regular wifi and connecting via the local IP given to your printer by your router.
Alternative Method - Use WPS
UPDATE 2023-12: Had to find a different method as resetting like above for some reason made the printer no longer connectable on the web interface.
Start the WPS procedure on your router.
Press and hold the Wifi-button for a few seconds.
Wait and pray. If successful the Wifi LED should go from blinking to just on.