According to Apple’s support page, “A limited number of Apple USB-C charge cables that were included with MacBook computers through June 2015 may fail due to a design issue. As a result, your MacBook may not charge or only charge intermittently when it’s connected to a power adapter with an affected cable.”
To find out if you have the affected cable, just look on its side. If it reads, “Designed by Apple in California. Assembled in China,” and that’s all there is on it, then you have the affected cable. The redesigned cables will have the exact same wordings, but will also have a serial number accompanying it as well (see screenshot above).
Apple will replace the cables for free if you were to take it in. It also applies to standalone cables that you might have bought separately from the company as well. “Apple will provide a new, redesigned USB-C charge cable, free of charge, to all eligible customers. This program also covers Apple USB-C charge cables that were sold as a standalone accessory.”