Update Status Timeout
-
Here’s the rundown-
I have created a plugin which displays all orders in a nice format for a bakery using Flexigrid. The display works just fine. The problem is that I have a button at the end of each order row that will allow the shop manager to update an order status. All this is in the admin panel. Here is the code:
function wc_mark_sg_order_complete($order_id){ global $woocommerce; if (!$order_id) die; $order = new WC_Order($order_id); //$order->payment_complete(); $order->update_status( 'completed' ); wp_safe_redirect( wp_get_referer() ); } add_action('wp_woocommerce_sg-mark-order-complete', 'wc_mark_sg_order_complete'); if(!empty($_GET["orderComplete"])){ do_action('wp_woocommerce_sg-mark-order-complete', $_GET["orderComplete"]); }
This code works. The problem is the time it takes for the code to work. When I update an order status on the Woocommerce orders page, the status is updated near-instantly. When I use this function to update an order status, it will take exactly 60 seconds to complete. Something here is not ending the call to the database or something I feel like. While the script is running, the entire database is locked and I cannot load the website in any other tabs until the action is completed. The database puts the query in to “Sleep” mode, I’m not sure if this has anything to do with it or not.
Basically, I just need to figure out how to get the code to execute instantly instead of taking the timeout period of 60 seconds to complete.
Thanks for any assistance! It is much appreciated!
- The topic ‘Update Status Timeout’ is closed to new replies.