What is the action triggered in thank you page

[ad_1]

Hello,

I am using cartflows in my woocomerce store to customize the default checkout and thank you page of woocomerce . however I need now to change the default status of the new orders to be on-hold instead of processing
to do that i tried to add the following code snippet I found on woocomerce docs :

add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) { 
    if ( ! $order_id ) {
        return;
    }

    $order = wc_get_order( $order_id );
    $order->update_status( 'on-hold' );
}

But this uses the “woocomerce_thankyou” action which is triggered only when the customer uses the default woocomerce checkout and not the cartflows one .

so i need the action that is triggered by your thank you page so i can change the default order status.

I hope my explanation was clear and thank you so much !

EDIT: I Checked the codebase of the plugin and found that you are actually using woocomerce_thankyou action hook , so i doubled checked my code snippet and found that i didn’t activate the snippet !! oh i feel embarassed , anyway thank you

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer