Zee
(@doublezed2)
Hello Alain Aubry,
Thank you for contacting WooCommerce support.
I understand you want to prevent virtual orders from automatically being marked as “complete” so you can manage their status manually.
This behavior is the default in WooCommerce. You may need a custom code or a plugin to control the order status and set it to “processing” instead of “complete.”
Let me know if you have more questions.
Best regards.
I was looking for a hint, about a custom code.
It is not a difficult question.
Thank you very much
Hi @caban13,
I believe @doublezed2 understands your request, but creating complex shortcodes to address your issue, especially those requiring advanced customization, falls outside the support scope of this forum.
That said, I found a hook that can achieve exactly what you’re looking for. This snippet will automatically change the status of every virtual order marked as “completed” to “processing.” You can use the code below:
add_action('woocommerce_payment_complete', function ($order_id) {
$order = wc_get_order($order_id);
// Only change status for virtual orders that are completed
if ($order && $order->has_status('completed') && $order->is_virtual()) {
$order->update_status('processing');
}
});
Simply copy this code and paste it into your functions.php file. Alternatively, you can use a code snippets plugin to add it to your site.
If this solution doesn’t work for you, it might be necessary to consult a developer to review your setup and implement the filter and action properly according to your needs.
Thank you very much @mosesmedh !
This is the kind of response I was expecting !!
Your answer together with some hints I gathered in another forum are giving me light.
That hook “woocommerce_payment_complete” or maybe “woocommerce_payment_complete_order_status” are going to give the results I expect.
Zee
(@doublezed2)
Hello Alain Aubry,
Thank you for your reply.
I am glad to know that you have resolved the issue.
I appreciate you for sharing the solution here.
Feel free to contact us again if you have more questions.
Have a great day!