• Resolved MiKeZZa

    (@mikezza)


    I use this plugin; https://nl.wordpress.org/plugins/wc-place-order-without-payment/ to have an order process without payment. The proces is more a ‘I want to rent this products’ and from there one the customers and site owner get in contact.

    But it can happen that an order changes after this. You can only change the content of an order when the status is ‘Pending payment’. So I would like to have all the order to start in this status. Is this possible?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • mother.of.code

    (@imazed)

    The Mother of Code

    Hi there! Yes, that’s certainly possible, but you’ll need a bit of custom code to get it working. Instructions can be found here: https://www.knowband.com/blog/tips/how-to-change-the-default-order-status-on-woo-commerce/

    Hope that helps!

    Thread Starter MiKeZZa

    (@mikezza)

    Ok @imazed. Sounds good. But I want it to be set to a status where the order can be edited. So that’s ‘pending payment’, right?

    So how am I going to do that?

    /**
     * Plugin Name: My First Plugin
     * Plugin URI: http://www.mywebsite.com/my-first-plugin
     * Description: Change order status by default to 
     * Version: 1.0
     * Author: Erwin Slob
     * Author URI: https://www.eswebmedia.nl
     */
    
    #<editor-fold defaultstate="collapsed" desc="Default Status as Pending">
    function action_woocommerce_payment_complete( $order_id ) {  
          if( ! $order_id ) return;
            $order = wc_get_order( $order_id );  
            $order->update_status( 'pending' );
    };  
               
    // add the action  
    add_action( 'woocommerce_payment_complete', 'action_woocommerce_payment_complete', 10, 3 );  
    #</editor-fold>

    But I’m not sure about this. What must the status be? Is pending correct? Your example gives wc-print-invoice, but I can’t find out where this is coming from…

    But I’m not sure about this. What must the status be? Is pending correct? Your example gives wc-print-invoice, but I can’t find out where this is coming from…

    Here is the list of order status
    `
    ‘wc-pending’ => _x( ‘Pending payment’, ‘Order status’, ‘woocommerce’ ),
    ‘wc-processing’ => _x( ‘Processing’, ‘Order status’, ‘woocommerce’ ),
    ‘wc-on-hold’ => _x( ‘On hold’, ‘Order status’, ‘woocommerce’ ),
    ‘wc-completed’ => _x( ‘Completed’, ‘Order status’, ‘woocommerce’ ),
    ‘wc-cancelled’ => _x( ‘Cancelled’, ‘Order status’, ‘woocommerce’ ),
    ‘wc-refunded’ => _x( ‘Refunded’, ‘Order status’, ‘woocommerce’ ),
    ‘wc-failed’ => _x( ‘Failed’, ‘Order status’, ‘woocommerce’ ),

    Thread Starter MiKeZZa

    (@mikezza)

    You are awesome! Works great!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Set default order status ”’ is closed to new replies.