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?
- 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
1 Answer
Reset to default 2Like 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?
- 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
1 Answer
Reset to default 2Like 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
版权声明:本文标题:plugins - Exact Hook to payment methods 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745563899a2156332.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论