This will remove the unnecessary payment fields when adding a free product to checkout. It will keep the fields when a payment is needed.
Add this code to functions.php (if you don't know what this is, don't try it, use the plugin below):
As always, test.
- (Not Tested) WooCommerce Checkout for Digital Goods