0

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?

Community
  • 1
  • 1
JMC_3030
  • 119
  • 2
  • 8
  • 1
    The thing with WordPress schedule tasks is that they depend on traffic to be triggered (as I'm sure you're already aware of). However, you can set up a cron job that "wakes up" your site at a certain time of the day so it performs all pending schedule tasks. The actual details on how to do this I'll leave it to you to figure out as there are quite a few guides on the Internet already that explain it. – cabrerahector Jun 04 '19 at 18:45
  • A cron job, or scheduler in Windows, is the only reliable way to make sure that a process is run at a specific time on specific days. – Dave Jun 04 '19 at 19:14

0 Answers0