My radio didn't work after getting a new battery. And I didn't have the code as I bought the car used.
Any Volvo dealership can get the code; they need your VIN number and the radio serial number. The radio itself pops out pretty easily and the serial number is right on top. Volvo of N. America won't release the code directly to the consumer; only to an authorized dealership. It's a four digit code.
I had the unfortunate experience of being told I had to buy a new radio "because there's no code for it". The dealership wanted me to spend $230.00 then and there. Fortunately, I ain't that dumb.
I drove to ANOTHER dealership who had the code in two minutes flat and at no charge.
Talk about music to your ears.
Keep that code in a safe place; I also ended up writing it on the radio itself. Nobody wants to steal this radio, believe me, and it is incredibly easy to just pop it out of the dash.
Beware of any dealer that gives you a BS line about no codes or recoding. They are trying to steal your $$$$.