• Resolved maielneklawy

    (@maielneklawy)


    Hi,
    I need updating order status from processing to completed automatically, I used snippet code

    /**
     * Auto Complete all WooCommerce orders.
     */
    add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
    function custom_woocommerce_auto_complete_order( $order_id ) { 
        if ( ! $order_id ) {
            return;
        }
    
        $order = wc_get_order( $order_id );
        $order->update_status( 'completed' );
    }

    The order updated successfully from processing to completed automatically but return to processing again ?!
    N.B—> when users pay through myCred the order status update from processing to complete automatically, the problem appears when paying through payment gateway.
    N.B—> My website works through the integration between learnpress and woocommerce.
    What am I miss, please?!

Viewing 1 replies (of 1 total)
  • Hi @maielneklawy

    Thanks for reaching out!

    Firstly, I apologize for the delayed response.

    I understand that you want to automatically update the order status from Processing to Completed using the code above, however it is not working when paying through the payment gateway, is that correct?

    Can you please share what payment gateway are you referring to here?

    Furthermore, I’d like to understand your site properly, can you please share your System Status Report, that will help us further troubleshoot.

    You can find it via WooCommerce > Status. Select Get system report and then Copy for support. Once you’ve done that, you can paste it into your reply here.

    If you could also provide the fatal error logs (if any) under WooCommerce > Status > Logs.

Viewing 1 replies (of 1 total)
  • The topic ‘Update order status from processed to complete automatically’ is closed to new replies.