Source: Apple
If you're one of the unlucky few whose MacBook Pros won't charge past 1%, Apple can replace the battery for you without any charges. Laptops affected by this issue will show the "Recommended Service" message in the battery menu. According to an updated Apple support page, the 2016 or 2017 MacBook Pro models that display this message can be brought into Apple to get replaced.
But you need to contact the company first and allow them to examine it to verify that your unit is eligible for the free replacement.
Apple also recommends users download macOS updates that prevent this issue from happening. You either need to update to macOS Big Sur 11.2.1 or later or install the macOS Cataline 10.15.7 supplemental update. Head to the Apple menu, then click on Software Update to check for the necessary updates.
This problem affects only these 2016 and 2017 MacBook Pro models:
According to Apple, to determine if your battery needs service, check the battery health: