Woocommerce Payment custom thank you page

I’m using woocommerce to handle orders on my wordpress
and i’m using a custom payment gateway plugin . everything works perfectly except that i want to modifate the thank you page wich tells the customer that the order has been successfuly registered .
the process payment function :

public function process_payment( $order_id ) {
    global $woocommerce;
    $order = new WC_Order( $order_id );
    // Mark as on-hold (we're awaiting the cheque)
    $order->update_status('on-hold', __( 'Awaiting payment', 'woocommerce-other-payment-gateway' ));
    // Reduce stock levels
    $order->reduce_order_stock();
    if(isset($_POST[ $this->id.'-admin-note']) && trim($_POST[ $this->id.'-admin-note'])!=''){
        $order->add_order_note(esc_html($_POST[ $this->id.'-admin-note']),1);
    }
    // Remove cart
    $woocommerce->cart->empty_cart();
    // Return thankyou redirect
    return array(
        'result' => 'success',
        'redirect' => $this->get_return_url( $order )
    );  
}

i want when the user sees the thank you page he will be automaticaly redirected after it .

i don’t want to change the redirect url on the array like :

'redirect' => 'http://example.com/'

i want to redirect him after he sees the page , how can i manage to do that ?

thanks in advance.

Read more here: Woocommerce Payment custom thank you page

Leave a Reply

Your email address will not be published. Required fields are marked *