Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Yame-/0365646952da00ae5e7d to your computer and use it in GitHub Desktop.
Save Yame-/0365646952da00ae5e7d to your computer and use it in GitHub Desktop.
<?php
function catch_new_order($orderid){
// Check for new order
// Set a scheduled event after 10min to check if order has been succesfully proccesed.
// If not, send SMS with orderID and name of client.
// 1: We are setting the time of the event after 10 minutes.
// 2: We provide an action to be called if the event is run.
// 3: We provide additional parameters to got with the action. In this case our order id.
wp_schedule_single_event( time() + 600, 'send_sms_if_order_failed', array( $orderid ) );
}
add_action( 'woocommerce_new_order', 'catch_new_order', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment