Retry WooCommerce Subscriptions gateway failed renewals

Recently I had a client come to me who had a gateway error, woocommerce subscriptions was not processing renewals correctly. So after a few days we fixed it but there was about 600 failed renewals for $5 each that needed to be re-entered. Since woocommerce doesn’t have a way to to do this I needed to create a script that would loop through failed and pending orders and try the renewal again. If you use this script just create a plugin file and navigate to ?retry=1  or use the funciton in your own file!

https://gist.github.com/anthonysbrown/f87e220429c13c6913a46ed59f9d158d