Redirect Offline Payment Only?

This topic contains 2 replies, has 2 voices, and was last updated by  Don West 10 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #14242

    Hi,
    Great Plugin! Replacing Events Manager Pro with it provided I can get this to work. Since I’ve already purchased it I’m hoping there is an easy solution, as there was with Events Manager Pro 😉

    I use the PayPal Gateway and the Offline gateway.
    I need to redirect only the Offline Gateway after a booking to a page that I specify.
    That page gives the user the option to pay me online with a check (something I wrote with the use of Gravity Forms and their PDF addon), or Redeem a gift certificate (PDF Voucher Addon for WP-eStore).

    This is currently working at my site http://www.donwestworkshops.com. Book an event and select the “Pay WIth a Check/Gift Certificate” Gateway and you will be redirected to said page. The redirect was a few lines of code the developer (finally) posted deep in the annals of his forum. It was deposited in the functions.php file of the theme and worked fine ever since.

    I just need the same little function for your application to work for me 🙂 Note that if I use the suggested redirect to URL feature now present in the settings, my PayPal users are redirected to my offline gateway payment page as well…which is NOT good. They need to go to the thank you page 🙂

    Can you give me some code love on this? Or some direction as to what hook to use? Thanks! 🙂

    Don West
    #14247

    Hi Don,

    I’m glad you like the plug-in :). There is a simple solution:

    add_action( 'eventorganiser_pre_gateway_booking_offline', 'my_offline_gateway_redirect', 10, 4 );
    function my_offline_gateway_redirect( $booking_id, $booking, $errors, $form ){
    
        $total_price = eo_get_booking_meta( $booking_id, 'booking_amount' );
    
        if( $total_price ){
    
            //TODO replace slug below with that of the intended page or hardcode page ID
            $page_id = get_page_by_path( 'pay-offline' ); 
    
            if( $page_id ){
                wp_redirect( get_permalink( $page_id ) );
                exit;
            }
    
        }
    
    }
    

    You will just need to replace ‘pay-offline’ with the slug of the target page, or otherwise set $page_id to the ID of the target page.

    The snippet also checks to ensure that there is an amount to be paid, as otherwise you probably don’t want to redirect them to the “how to pay” page.

    Stephen Harris
    #14248

    Thanks so much Stephen! I can’t say enough how much it matters that you are there supporting your work with front line knowledge and access. Not so much the case with many developers it seems…Even the big guys.

    I realize this type of request was one-off in nature as not everyone goes to the effort to develop their own check pay system for their site. Thus the lack of built-in accommodation of custom redirects for offline payment methods. So I truly appreciate you 🙂 I had a feeling your product was further along support and documentation wise and that’s why I’m replacing the other one.

    Keep up the great work! You da Man!

    Don West
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.