2

When the admin manually changes an order status from pending to processing payment, I would like to redirect this admin to an external website for completing an additional step. The customer should not be redirected at any stage, just the admin.

I have added this to my function.php, but nothing happens on status change:

function my_woocommerce_order_status_processing($order_id) {
  header('Location: http://www.google.com');
}
add_action('woocommerce_order_status_processing', 'my_woocommerce_order_status_processing');

Please, how can I achieve this?

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • The admin should be redirected when they manually change the order status to processing payment, not the customer. When the order is changed to processing the admin needs to mark something on another website (hence the redirect). –  Jul 05 '16 at 15:04
  • Do you know of a hook that exists for the backend? I'm looking through the docs but cannot find anything relevant to the orders page for admins. –  Jul 05 '16 at 15:44
  • As I have say, this hook is just for fronted… I don't think that you can do that with just a hook (even an admin one)… But i hope that someone will make a good answer to solve your issue. – LoicTheAztec Jul 07 '16 at 23:52

2 Answers2

-1

Have you tried using this hook?

add_action( 'woocommerce_order_status_processing', array( $this, 'yourfunction_order_processing') );

I'm using this hook in the backend to generate some special packing slips and automation processes, I think it could be easily hooked this way. Tested with WC 2.6

funkysoul
  • 3,023
  • 1
  • 17
  • 27
-1
function custom_processing($order_id) {
    if (is_admin()) {
        header('Location: http://www.google.com');
        die();
    } else {
        echo $order_id; // do whatever you want
        exit;
    }
}

add_action('woocommerce_order_status_processing', 'custom_processing');

Tested OK

mujuonly
  • 11,370
  • 5
  • 45
  • 75