• Resolved kader1303

    (@kader1303)


    Hello I′m working on my store and I′m having trouble with the status of my orders. For what I know Woocommerce automatcly sets virtual orders as complete after paymente received, but I dont want that, I want when the payment its done the order status goes to prossecing instead of complete. thanks in advance.

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

Viewing 1 replies (of 1 total)
  • Thread Starter kader1303

    (@kader1303)

    Hello this code solved my problem:

    add_action( ‘woocommerce_thankyou’, ‘custom_woocommerce_auto_complete_paid_order’, 999, 1 );
    function custom_woocommerce_auto_complete_paid_order( $order_id ) {
    // Only for ‘woo_credits’ payment gateway
    if ( ! $order_id || ‘woo_credits’ != get_post_meta($order_id, ‘_payment_method’, true) )
    return;

    // Get an instance of the WC_Order object
    $order = wc_get_order( $order_id );

    // Update order status back to ‘processing’
    $order->update_status( ‘processing’ );
    }

    Regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with order status in virtual orders’ is closed to new replies.