Check the tune on the current shock. If it’s and older fox it’ll be written near the bottom of the can. Three coloured strips for redbound, compression and boost valve if it has one. Newer fox just have a bar code.
I think rockshox do something similar but I can’t remember. You’ll want your new shock to have a similar, or better tune for your bike so if buying off the shelf look for the same tune, or you can get any shock and send it to someone like loco tuning. They can put an appropriate tune on it to either match or surpass the factory one depending on your needs. They may be able to get a better tune for your current can meaning you don’t need to buy a new one.