WooCommerce , Auto cancel orders status from processing after X days

You need to know that you can do it directly with a function in your functions.php file or a plugin, but it’s not the best solution. For me the best solution is a cron job associate with your action because you wanna check each hour/day/week/or month the payment status of your orders. You don’t want connect yourself on the website for the function work each time you want check this status.

(btw, sorry for my bad english)

For answer to your question, I see your code here: https://wordpress.org/support/topic/expiring-on-hold-cheque-orders-after-x-days/#post-10000589

I think this solution’ll work only if you add the action to the cron job.