How to set orders to automatically complete when payment is sucessful?

This topic has 4 replies, 3 voices, and was last updated 6 months, 1 weeks ago ago by Andrew Mitchell

  • Avatar: Woolwolf
    Woolwolf
    Participant
    November 20, 2024 at 12:13

    I have noticed that WooCommerce by default, sets the order status to “processing” when an order is placed. However, since I only sell downloadable products, I am concerned that my customers may be confused by receiving an email stating that their order is being processed, especially when the same email also includes their download link. Is there a way to automatically set these orders to “completed” as soon as the payment is received?

    Best regards,
    Trine

    Please, contact administrator
    for this information.
    Files is visible for topic creator and
    support staff only.
    3 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    November 20, 2024 at 14:20

    Dear @Woolwolf,

    We hope this message finds you well.

    To address your request, please try adding the following custom code to the functions.php file located in your child theme:

    
    add_action( 'woocommerce_payment_complete', 'wpdesk_set_completed_for_paid_orders' );
    function wpdesk_set_completed_for_paid_orders( $order_id ) {
        $order = wc_get_order( $order_id );
        $order->update_status( 'completed' );
    }
    

    For further details and guidance, you may refer to this article: [WooCommerce Payment Complete Hook](https://wpdesk.net/blog/woocommerce_payment_complete-hook/).

    Should you have any questions or need additional assistance, please feel free to reach out.

    Best regards,
    The 8Theme Team.

    Avatar: Woolwolf
    Woolwolf
    Participant
    November 25, 2024 at 13:05

    Thank you for your help! I have inserted the code, and It is working great.

    Unfortunately, another problem has occurred. I’m selling a downloadable product, but the download link is missing from the “order complete” page and the email confirmation.

    Can you help me fix this?

    Best regards,
    Trine

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    November 25, 2024 at 13:13

    Dear Woolwolf,

    As we continue our mission to exceed expectations, your insights become increasingly valuable. Could we, with all due respect, request your thoughtful feedback by giving our theme a deserved 5-star rating on ThemeForest?

    Click here to share your valuable perspective: https://themeforest.net/downloads

    Your time and trust are highly appreciated!

    Best Regards,
    The 8Theme Team

  • Viewing 4 results - 1 through 4 (of 4 total)

The issue related to '‘How to set orders to automatically complete when payment is sucessful?’' has been successfully resolved, and the topic is now closed for further responses

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.