Woocommerce Payment Gateway weird thank you redirect

Viewed 403

My first post here so be gentle. I am using an old payment gateway in my woocommerce website, should be compatible with 2.3.0 (now it's 4.0) Everything is working fine, but when the payment is completed the plugin redirect the customer to some weird "Thank-You" Page.

URL:

"https://www.BLABLA.com/checkout/order-received/1089/?key&Response=000&ConfirmationCode=0059405&index=B50174968&amount=0.50&firstname=BLABLA&lastname=BLABLA&email=BLABLA@BLABLA.co.il&phone=123123123&payfor=Your%20purchase%20at%20:%20BLABLA&custom=&orderid=1089"

and the page says: "Order received, Thanks for your order."

The URL should be:

https://www.BLABLA.com/checkout/order-received/1089/?key=wc_order_CwAw8ywHC8Mey

I want the plugin to redirect the customer to the woocommerce regular Thank-You page after completing the payment instead of this weird one.

WooCommerce provides helper functions in the order class for getting these URLs. They are:

$order->get_checkout_payment_url( $on_checkout = false );

and:

$order->get_checkout_order_received_url();

I can't figure out how to implement this code into the plugin files successfully. My coding skills are pretty lame. So I'll appreciate any help.

I think that this is the piece of code that's needed to be edited.

        wp_redirect( $checkout_url );
        exit();
         Return thankyou redirect
        return array(
            'result' => 'success',
            'redirect' => add_query_arg(array('order-received' => $order_id, 'key' => $order->get_order_key()), $checkout_url)

Thank you for your time!

0 Answers
Related