Change the free order status to on hold by default in WooCommerce

Change the free order status to on hold by default in WooCommerce on child sites.

Snippet Type

Execute on Child Sites

Snippet

function change_free_order_status( $order_id ) {  
    if ( ! $order_id ) {return;}            
    $order = wc_get_order( $order_id );
    if($order->get_total() <= 0):
        $order->update_status( 'on-hold' ); // Change to what you need 
    endif;
}
add_action('woocommerce_thankyou','change_free_order_status');

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.