I am developing a WooCommerce site that uses WooCommerce/Twillio SMS plugin (https://docs.woocommerce.com/document/twilio-sms-notifications/) to send SMS messages to customers whenever an order status changes. I am looking to use this to send SMS reminders to customers whose statuses are on hold. So far, I've created two custom order statuses (1st-reminder, 2nd-reminder) and tested the plugin to ensure these custom statuses send the correct SMS reminder.
The problem I'm having is finding a method that can automatically change an order status after a certain period of time. Ideally, the workflow I'm looking for is:
if order status is 'on-hold' for 3 days, change order status to '1st-reminder'
if order status is '1st-reminder' for 4 days, change order status to '2nd-reminder'
I've already searched stackoverflow for a way to change an order status in functions.php of the plugin I created for this project (WooCommerce - change order status with php code). Now I am looking for the best method to trigger this change.
Cron jobs seem to be the best method of setting up a timed action in my research, but I haven't found an example that fits my specific use-case.
Is it possible to use cron for these automatic order status changes, or should I look into an alternative solution?