• Resolved kdmahesh1788

    (@kdmahesh1788)


    Suddenly, since the last 2 days, all my e-store orders status is getting automatically marked as ‘Completed.’ I want them to be marked manually only. So, please give me the solution to resolve this problem?

    On one of the thread, I found this code to prevent any orders from autocompleting. So, is the right solution to my problem? If Yes, then please guide me where I should add the following code in my site page?

    /*prevent any orders from autocompleting*/
    /*
     */
    add_action( 'woocommerce_thankyou', 'stop_auto_complete_order' );
    function stop_auto_complete_order( $order_id ) { 
        if ( ! $order_id ) {
            return;
        }
    
        $order = wc_get_order( $order_id );
        $order->update_status( 'processing' );
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • AJ a11n

    (@amandasjackson)

    Hi @kdmahesh1788

    What are the types of products that are being purchased on the orders that are being marked as Completed (Simple, Variable, Virtual/ Downloadble, etc) ?

    Does this happen with only the WooCommerce core plugin active?
    ?
    The best way to test is to:
    ?

    • Temporarily switch your theme to Storefront
    • Disable all plugins except for WooCommerce
    • Repeat the action that is causing the problem

    If you’re not seeing the same problem after completing the conflict test, then you know the problem was with the plugins and/or theme you deactivated. To figure out which plugin is causing the problem, reactivate your other plugins one by one, testing after each, until you find the one causing conflict. You can find a more detailed explanation on how to do a conflict test here.

    Before using code to stop what is happening, I’d recommend testing to determine the route cause first ??

    Thread Starter kdmahesh1788

    (@kdmahesh1788)

    Hi,

    – Product Type is Simple.

    – And the Testing part which you have suggested, it won’t be possible for us now since our website and digital marketing campaigns are live now.

    – And really it’s an urgency to resolve this issue. So, the code which I have mentioned in the previous thread, is it right? If, Yes then on which site page shall I add it?

    Please give me a solution.

    AJ a11n

    (@amandasjackson)

    Hi there,

    It sounds like a staging site would be a good idea to test the code to make sure it works properly. If your host doesn’t offer that option, we recommend WP Staging for quickly spinning up a new test site.

    As far as adding custom code to your site, you will want to either add it to the functions.php of your child theme or use a plugin such as Code Snippets. Both methods are explained here:

    https://woocommerce.com/posts/properly-add-woocommerce-custom-code/
    https://docs.woocommerce.com/document/customizing-woocommerce-best-practices/

    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @kdmahesh1788!

    If your simple type products are virtual and or downloadable, then what you are describing would be expected behavior and you can use some code to “force” those orders to go to “processing” rather than completed.

    As Amanda already mentioned, do run it on a staging site to make sure it works as expected before pushing it to your production site. Also, use the snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update

    Cheers!

    Moderator Hari Shanker R

    (@harishanker)

    Hi @kdmahesh1788

    I hope the suggestions we passed along to you in the previous reply guided you in the right direction.

    We haven’t heard from you in a while, so we’re marking this thread as Resolved for now.

    Please feel free to reply to us in this thread, should the problem persist. We are happy to look into this and guide you further.

    All the best!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disable automatic order completion’ is closed to new replies.