Skip final review page after paypal express checkout – Woocomerce

I’m working on this Hotel website project for one of my clients.

Website: http[:]//www[.]dreamshotelmaldives[.]com/

Read More

CMS: WordPress /

Plugin: Woocommerce / AWEBooking

Payment-gateway: https[:]//www[dot]woothemes[dot]com/products/paypal-express/

The website’s reservation module is fully integrated with a Third Party Plugin called, AWEBooking. and i use WooCommerce for the checkout process and an additional extension plugin from woothemes to integrate the Paypal Express Checkout option.

Problem: Well the problem is after you select a room and head to checkout it directs to paypal sandbox cgi (since using sandbox credentials for testing), it REDIRECTS TO AN UNWANTED PAGE, SEE BELOW SCREENSHOT.

UNWANTED CART PAGE

What I want to do is skip that page and head right away to the thank you page! please see below screenshot,

WHAT I WANT TO DISPLAY

I’ve seen that Angeleye paypal vendor plugin has an option to SKIP the final review page, but not this plugin!

Below is a code snippet from the plugin code, file name ‘class-wc-gateway-paypal-express.php’

#

        // called when the customer is returned from PayPal after authorizing their payment, used for retrieving the customer's checkout details
        case 'get_express_checkout_details':

            // bail if no token
            if ( ! isset( $_GET['token'] ) ) {
                return;
            }

            // get token to retrieve checkout details with
            $token = esc_attr( $_GET['token'] );

            try {

                $response = $this->get_api()->get_express_checkout_details( $token );

                // save customer information to session
                WC()->session->paypal_express_checkout = array(
                    'token'            => $token,
                    'shipping_details' => $response->get_shipping_details(),
                    'order_note'       => $response->get_note_text(),
                    'payer_id'         => $response->get_payer_id(),
                );

                // ensures PPE is selected at checkout
                WC()->session->chosen_payment_method = get_class( $this );

                // redirect customer to checkout
                wp_redirect( WC()->get_checkout_url() );

            } catch ( Exception $e ) {

                $this->add_debug_message( $e->getMessage(), 'error' );

                wc_add_notice( __( 'An error occurred, please try again or try an alternate form of payment.', WC_PayPal_Express::TEXT_DOMAIN ), 'error' );

                wp_redirect( $cancel_url );
            }

            exit;
    }
}

#

I THINK, what i got to call is for woocommerce endpoint url “$order>get_checkout_order_received_url();” please help me how to include this code and SKIP the UNWANTED PAGE!

THANK YOU FOR YOUR TIME!
AISAR

Related posts