You should research you problem more broadly rather than just asking others to do it all for you.
You need to know:
- Voltage and power level for the solenoid
- Voltage tolerance and power level for the 'Pi W (which will depend largely on the connected peripherals)
Assuming a 'Pi W with no attached peripherals you can expect:
- Voltage must not go below 4.95V at the 'Pi input terminals, and I'd recommend no more than 5.2V
- Current in the range of 350-500mA. Read this excellent set of answers: https://raspberrypi.stackexchange.com/questions/341/whats-the-current-draw-and-supply-voltage-tolerance) This gives a maximum power required of about 2.6W
With your solenoid actuated (3W) and the 'Pi W (2.6W) your total power supply needs are about 5.6W @ 12V. Add a fudge factor and select any 12V wallwart that can supply at least 1A ….this gives you 12W of available output power.
Use any of the common LM2596, MP2307 or MP1584 based buck regulator modules available (I assume you don't want to build your regulator) to convert your 12V Wallwart output to 5V for the 'Pi W. Remember to adjust the output voltage of the regulator BEFORE you connect to the 'Pi W.