• Resolved moeinmr

    (@moeinmr)


    When the customer charges the wallet, his order status processing. And I have to change the status manually to the completed state. What can I do to make the automatic order status complete after charging the wallet?

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

    (@subratamal)

    @moeinmr For this please use the attached code in the theme functions.php file.

    add_filter('woocommerce_payment_complete_order_status', 'woocommerce_payment_complete_order_status_callback', 10, 2);
    
    if(!function_exists('woocommerce_payment_complete_order_status_callback')){
        function woocommerce_payment_complete_order_status_callback($status, $order_id){
            $order = wc_get_order($order_id);
            if('wallet' === $order->get_payment_method('edit')){
                $status = 'completed';
            }
            return $status;
        }
    }
    Thread Starter moeinmr

    (@moeinmr)

    Does not work!

    Plugin Author Subrata Mal

    (@subratamal)

    @moeinmr it should work. Please make sure you put the code in right place.

    Thread Starter moeinmr

    (@moeinmr)

    I put it in the right place but it does not work

    Thread Starter moeinmr

    (@moeinmr)

    up

    Plugin Author Subrata Mal

    (@subratamal)

    @moeinmr We tested the code and it is working for us.

    Thread Starter moeinmr

    (@moeinmr)

    Anyway, I tried this code many times and it did not work

    Plugin Author Subrata Mal

    (@subratamal)

    @moeinmr Please try this code.

    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 moeinmr

    (@moeinmr)

    Does not work!

    Plugin Author Subrata Mal

    (@subratamal)

    @moeinmr It might be your site issue. Please contact with your developer regarding this.

    Thread Starter moeinmr

    (@moeinmr)

    There is no problem with the site because I have 3 different sites and your code does not apply to any of them

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

The topic ‘Payment status to be completed’ is closed to new replies.