Chosen Solution
I bought the battery repair kit for a mid-2012 13” MacBook Pro and installed it. (The original battery was not holding charge well at all and the computer was a little bit slow, but didn’t appear to have other problems.) After a few days with the new battery, the computer started shutting off apparently at random. I tried SMC and PRAM resets, but the problem came back. Then, a few days after that and while the charger was plugged in, the computer stopped recognizing that there was a battery installed altogether. I tried taking the battery out and putting it back in, at which point it recognized the battery was there, but again, a while after I began charging it, the same thing happened — it did not recognize that a battery was installed. At that point I returned the old battery, which functions exactly as it did before. Does this sound like a problem with the specific replacement battery, or something to do with my computer? EDIT: have added a screenshot from coconutBattery, showing information for the replacement battery.
The battery looks fine! I would check the MagSafe charger. Is the cord worn or the connector dirty or damaged? Review this Apple T/N Apple Portables: Troubleshooting MagSafe adapters Also make sure you’ve got a real one OEM MagSafe Chargers vs Cheap Imposters: Teardown for Truth. Is the MagSafe socket contacts clean and shiny? You may need to replace the DC-In Board.
If the old battery functions fine like you said it did, I’d side with it being some sort of issue with the replacement battery. See if you can get another replacement, if it was an iFixit battery they’re all warrantied for defects for 1 year so it shouldn’t be an issue.