Headphone cable fix

I have a pair of headphones that got ruined and I had to replace the plug. I messed up so many times that I cut the length down pretty short.(to the length of the coiled part of my ath m50’s) I want to get rid of the coiled cable but I dont know where or how to replace the cable with another straightened cable with a plug at the end. Would anyone have any expertise in cabling for headphones?

This exact same thing happened to me except with a pair of sony headphones, I forgot what brand.

Anyway I just learned my lesson and bought the ath m50x, which has separable cables from the main headphones.

I know there’s really smart tech people here who can probably help you so I’d wait for their replies.

Yeah I kinda wished that the m50x was out when I bought my m50s. Im not in any position to buy new headphones atm so If I can get a cool solution then that would be alot easier on my wallet.