admin管理员组

文章数量:1022752

I'm using this hook woocommerce_order_status_processing to check if an order is payed and update the user with a memberplan. The problem is that manual update, acessing woocommerce menu > orders > change status from any to processing works, but when the online payment returns and change the status programatically appears that the hook woocommerce_order_status_processing is not being used and my client's status is not being changed. How I can find which hook I need to use? Someone have a tip?

I'm using this hook woocommerce_order_status_processing to check if an order is payed and update the user with a memberplan. The problem is that manual update, acessing woocommerce menu > orders > change status from any to processing works, but when the online payment returns and change the status programatically appears that the hook woocommerce_order_status_processing is not being used and my client's status is not being changed. How I can find which hook I need to use? Someone have a tip?

Share Improve this question edited Jul 11, 2018 at 0:43 Jacob Peattie 44.2k10 gold badges50 silver badges64 bronze badges asked Jul 10, 2018 at 16:12 Rafael FigueiredoRafael Figueiredo 331 silver badge5 bronze badges 4
  • What did you mean with "when the online payment returns"? – user141080 Commented Jul 11, 2018 at 19:01
  • Think paypal. If paypal is processing the order they return a value and woocommerce update the order. When this is ocurring my function is not being called. But if I access my wp-admin, go to the order and manually change the status my function is called. I think is something with the hook I'm using. – Rafael Figueiredo Commented Jul 11, 2018 at 19:09
  • Have you looked in the code of your payment plugin? Which one do you use? – user141080 Commented Jul 12, 2018 at 12:18
  • Yes. I looked before but somehow looking again now I discovered the correct hook. Thanks! – Rafael Figueiredo Commented Jul 13, 2018 at 18:23
Add a comment  | 

1 Answer 1

Reset to default 2

Like I said before change manually the data through admin works well with the woocommerce_order_status_processing hook. But the gateway I'm using was using other method and consequently other hook. The right hook is woocommerce_update_order.

Inside this hook was needed to use a conditional check if the status change to processing.

public function create_memberplan_after_update_order($order){
    $order = wc_get_order($order);
    if ($order->data['status'] == 'processing') {
        //update user when status is changed to processing
    }
}

I'm using this hook woocommerce_order_status_processing to check if an order is payed and update the user with a memberplan. The problem is that manual update, acessing woocommerce menu > orders > change status from any to processing works, but when the online payment returns and change the status programatically appears that the hook woocommerce_order_status_processing is not being used and my client's status is not being changed. How I can find which hook I need to use? Someone have a tip?

I'm using this hook woocommerce_order_status_processing to check if an order is payed and update the user with a memberplan. The problem is that manual update, acessing woocommerce menu > orders > change status from any to processing works, but when the online payment returns and change the status programatically appears that the hook woocommerce_order_status_processing is not being used and my client's status is not being changed. How I can find which hook I need to use? Someone have a tip?

Share Improve this question edited Jul 11, 2018 at 0:43 Jacob Peattie 44.2k10 gold badges50 silver badges64 bronze badges asked Jul 10, 2018 at 16:12 Rafael FigueiredoRafael Figueiredo 331 silver badge5 bronze badges 4
  • What did you mean with "when the online payment returns"? – user141080 Commented Jul 11, 2018 at 19:01
  • Think paypal. If paypal is processing the order they return a value and woocommerce update the order. When this is ocurring my function is not being called. But if I access my wp-admin, go to the order and manually change the status my function is called. I think is something with the hook I'm using. – Rafael Figueiredo Commented Jul 11, 2018 at 19:09
  • Have you looked in the code of your payment plugin? Which one do you use? – user141080 Commented Jul 12, 2018 at 12:18
  • Yes. I looked before but somehow looking again now I discovered the correct hook. Thanks! – Rafael Figueiredo Commented Jul 13, 2018 at 18:23
Add a comment  | 

1 Answer 1

Reset to default 2

Like I said before change manually the data through admin works well with the woocommerce_order_status_processing hook. But the gateway I'm using was using other method and consequently other hook. The right hook is woocommerce_update_order.

Inside this hook was needed to use a conditional check if the status change to processing.

public function create_memberplan_after_update_order($order){
    $order = wc_get_order($order);
    if ($order->data['status'] == 'processing') {
        //update user when status is changed to processing
    }
}

本文标签: pluginsExact Hook to payment methods