How to execute do_action after page is loaded?
-
I added an action to woocommerce_thankyou that has a 45 second delay in it and it causes the page to hang while it executes. I was wondering if there was some way hook this to an action that could fire after the woocommerce thankyou.php page has been built. I’ve already tried adding my own do_action at the end of the script but that didn’t work. The page still hangs for 45 seconds.
This is the action and its function…
add_action('woocommerce_thankyou', 'call_restaurant'); function call_restaurant() { sleep(45); require_once '/home/mywebsite/public_html/voice/Services/call.php'; $sid = "bla bla bla"; $token = "bla bla bla"; $from_number = "3055478873"; // Calls must be made from a registered Twilio number. $to_number = "3058345058"; $message = "Hello. You have received a new order from eat three sixty five miami dot com"; $client = new Services_Twilio($sid, $token, "2010-04-01"); /* $call = $client->account->calls->create( $from_number, $to_number, 'https://twimlets.com/message?Message='.urlencode($message) ); */ echo 'phone call has been made'; }
The reason that I’m doing this is because I am trying to place an automated phone call 45 seconds after the order is made.
Any help is greatly appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to execute do_action after page is loaded?’ is closed to new replies.