Home > Mobile >  Auto change order status from pending to completed in Woocommerce
Auto change order status from pending to completed in Woocommerce

Time:10-15

I am trying to change paid order status pending to completed.

CODE:

function wc_autocomplete_paid_orders( $order_status, $order_id ) {
    
    $order = wc_get_order( $order_id );

    if ( $order_status == 'pending' ) {
        return 'completed';
    }
    
    return $order_status;

} ```

THank you for the help.

CodePudding user response:

You should not do this programatically as this is done from the payment providers that your WooCommerce is configured to use whet a successful order payment has been issued.

If in case you use a payment provider in sandbox mode or test mode that does not do this and you need to test the completed order status, you can do change this manually from the WordPress admin panel:

  • WordPress Admin / WooCommerce / Orders - edit a PENDING oder and change it manually to COMPLETE.
  • Related