1

I have this simple hook

add_action('woocommerce_order_status_changed', 'function_test', 10, 3);

function function_test($id, $status_transition_from, $status_transition_to ) {
     error_log("¡Done!", 0);
}

The problem is that at this point, when I change the status in the order details but is not triggered.

enter image description here

I have been searching, but is not working anyway.

Here, woocommerce_order_status_completed not triggered, the user user5200704 comments that the method must appear in wp_filter.

This is right, my wp_filter at that point is:

[woocommerce_order_status_changed] => WP_Hook Object ( [callbacks] => Array ( [10] => Array ( [function_test] => Array ( [function] => function_test [accepted_args] => 3 ) ) )

Thanks

Diego Montagud
  • 76
  • 2
  • 13
  • Sorry but `woocommerce_order_status_changed` action hook works fine and is triggered each time when order status change using the methods `update_status()`, `set status()` and `save()` via the method `status_transition()`… – LoicTheAztec Apr 16 '19 at 09:53
  • When I change the status, after I save the product. And is not triggering. Is that what you are telling me? – Diego Montagud Apr 16 '19 at 12:37
  • Can you show all your real related code in your question, as your actual pseudo code isn't useful… Remember that *"Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error **and the shortest code necessary to reproduce it in the question itself**. Questions without a **clear problem statement** are not useful to other readers"*. – LoicTheAztec Apr 16 '19 at 12:46
  • Thanks, but all the related code is on. The error log is empty and that function is in the functions.php file. – Diego Montagud Apr 17 '19 at 11:42
  • Did you ever get this to work? – Les Sep 04 '19 at 14:08
  • Yes, with this hook `add_action( 'woocommerce_order_status_changed', 'order_cancelled_verify', 20, 1 );` it was not logging anything but it was running the code. Try with print_r – Diego Montagud Sep 09 '19 at 07:53
  • i have same problem after update it stopped working – GentSVK Mar 06 '22 at 18:52
  • I remember this project. After read documentation, the only way it could be done is with the thank yoy page hook. Order status was bugged. At least in that version. – Diego Montagud Mar 08 '22 at 07:44

0 Answers0