• Resolved james400studio

    (@james400studio)


    Hey,
    Is there any way to change the default order status to “completed” instead of “processing”?

    Any help would be appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    Hi @james400studio

    Please use below code snippet in theme function.php file to set order status to completed.

    add_action('woo_wallet_payment_processed', 'woo_wallet_payment_processed_callback');
    
    if(!function_exists('woo_wallet_payment_processed_callback')){
        function woo_wallet_payment_processed_callback($order_id){
            $order = wc_get_order($order_id);
            $order->set_status('completed');
            $order->save();
        }
    }
    Thread Starter james400studio

    (@james400studio)

    hey @subratamal ,
    Appreicate your help but this code is not working. I pasted this code in my theme’s function.php file, but the order status is still getting set to “processing”.

    Plugin Author Subrata Mal

    (@subratamal)

    Please check if you have placed the code in the active theme function.php file because we have checked this code in our local environment and it is working for me.

    Thank you.

    Thread Starter james400studio

    (@james400studio)

    @subratamal

    Hey,
    Found the issue. Actually it marks order “completed’ when the order payment is done via woo wallet.

    I actually need to mark the “wallet recharge order” as “completed” and not the orders paid through wallet.

    Sorry for the confusion.

    Thread Starter james400studio

    (@james400studio)

    @subratamal Update : sorry, I need to change the status to “wallet-recharge” of wallet top up order. I have already created custom “wallet-recharge” status. I tried this below code, but the wallet top is not showing in the wallet. So I guess it first needs to be marked as completed and then changed to “wallet-recharge”. Your help would be appreciated.

    Here’s the code I tried –

    add_filter('woocommerce_payment_complete_order_status', 'woocommerce_payment_complete_order_status_callback', 10, 3);
    if (!function_exists('woocommerce_payment_complete_order_status_callback')) {
    function woocommerce_payment_complete_order_status_callback($status, $order_id, $order) {
    if (is_wallet_rechargeable_order($order)) {
                $status = 'wallet-recharge';
            }
            return $status;
        }
    }
    Plugin Author Subrata Mal

    (@subratamal)

    Use bellow code instead.

    add_action('woo_wallet_credit_purchase_completed', 'woo_wallet_credit_purchase_completed_callback', 10, 2);
    
    if(!function_exists('woo_wallet_credit_purchase_completed_callback')){
        function woo_wallet_credit_purchase_completed_callback($transaction_id, $order){
            $order->set_status('wallet-recharge');
            $order->save();
        }
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Default order status’ is closed to new replies.