Вам не хватает параметров при настройке вашей add_action.
add_action( 'woocommerce_order_status_changed', 'create_contact_and_deal', 10, 1 );
function create_contact_and_deal($order_id=0, $status_transition_from="", $status_transition_to="", $instance=NULL) {
}
Должно быть:
function action_woocommerce_order_status_changed( $this_get_id, $this_status_transition_from, $this_status_transition_to, $instance ) {
// make action magic happen here...
if($this_status_transition_from == "pending" && $this_status_transition_to == "processing")
//Perform stuff when condition is met.
{
}
// add the action
add_action( 'woocommerce_order_status_changed', 'action_woocommerce_order_status_changed', 10, 4 );
Наиболее важной частью является четвертый параметр функции add_action
. ,1
в вашем примере передает только первый параметр, идентификатор , ,4
даст вам статусы при каждом изменении. Это последнее значение указывает, сколько параметров будет передано вашей функции обратного вызова.