If the shuffle still appears in iTunes when you connect it, you can try doing a Restore on it using iTunes, in case the cause is a software problem.
Use iTunes on your Mac or PC to restore your iPhone, iPad, or iPod to factory settings - Apple Support
If the problem recurs after the Restore, it is probably a worn out battery. It requires soldering skills to replace it yourself, and iPod shuffles (except for 1st gen) are very small. Not easy to work on. This web site has repair guides
https://www.ifixit.com/Device/iPod_Shuffle
and parts are available from sources like eBay.
Apple will "service" the shuffle, if it's 4th gen (current type). Rather than change the battery in your unit, you get a replacement unit. According to this document, the out-of-warranty fee is $39
iPod Service Pricing - Apple Support
NOTE: If your shuffle is less than one year from purchase date, it is under warranty.
The retail price of a brand new 4th gen iPod shuffle, with new headphones, docking cable, and one-year warranty is $49.