• Resolved Alain Aubry

    (@caban13)


    Hi

    [WooCommerce]

    Whenever a payment is completed the order is automatically the WC status is set to “complete”, provided the order is virtual.

    I understand that this a feature, you are assuming the order is going to automatically completed by the system, this is not my use case, I sell digital products that have to “delivered”, like a virtual online appointment that is going a happen in a few days or an online course that is set to start at a certain date, by the time the appointment happens, I will manually change the status.

    At this moment, I am changing the WC status manually in ALL this cases, my ideal status is “processing”. Operating this way the customer receives emails in the wrong order, very confusing.

    Do you have a setting, a filter or a hook that allows this?

    Thank you so much

    • This topic was modified 1 month, 3 weeks ago by Alain Aubry.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Zubair Zahid (woo-hc)

    (@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.

    Thread Starter Alain Aubry

    (@caban13)

    I was looking for a hint, about a custom code.

    It is not a difficult question.

    Thank you very much

    Plugin Support Moses M. (woo-hc)

    (@mosesmedh)

    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.

    Thread Starter Alain Aubry

    (@caban13)

    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.

    Plugin Support Zubair Zahid (woo-hc)

    (@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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.