Be careful with that; during disconnection of the magnetic part, the pins carrying 20 V on the cable can make momentary connections with other pins on the portion of the connector remaining in the machine; if this happens, the port may never work again (for charging, or for anything else).
I have been using this Magnetic USB C Adapter and am very happy with it: https://www.amazon.com/dp/B0816PV1YZ/