• Resolved Ambyomoron

    (@josiah-s-carberry)


    Until now, I have enabled only payment with a credit card and, as my product is simply access to a paid web site, I am happy to autocomplete all paid orders using an action to that effect in my functions.php.
    But now I wish to enable payment via SEPA direct debit, where there is a significant delay between placing the order and confirming that the customer has the necessary funds in her account. So I want to do one of two things, but am not sure how to achieve it:

    Here is my current code, with the pseudo-code that I want to add:

    function custom_woocommerce_auto_complete_order( $order_id ) { 
        if ( ! $order_id ) {
            return;
        }
    
        $order = wc_get_order( $order_id );
        if ($order->payment-is-NOT-by-SEPA) {
            $order->update_status( 'completed' );
        }
    }
    function custom_woocommerce_handle_SEPA_payment_confirmation( some_arguments ) { 
        if ( invalid_order ) {
            return;
        }
    
        $order = get_the_order_from ( one_of_the_arguments );
        if ($order->payment-is-by-SEPA AND $order->payment_succeeded) {
            $order->update_status( 'completed' );
        }
    }

    Any hints about how to achieve this would be welcome.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Enabling autocomplete for certain payment types only’ is closed to new replies.