How To Change The Return Url (PayPal)

As mentioned in this article on enabling auto-redirect, setting the return url [in PayPal accounts] will not affect the url they are redirected too as the plug-in specifies the return url when it sends the user to the gateway.

By default users are returned to the booking page with a thank you noticed displayed at the top. To change the page to which they’re returned you can use the eventorganiser_pre_gateway_checkout_paypal hook. This filter, filters the cart array, before it is used to generate the url to which the bookee is sent to complete payment.

More generally, to filter a gateway’s cart:


(with the exception of the ‘offline’ gateway).

Since carts differ from gateway to gateway, the following is only intended for the PayPal gateway.

add_filter( 'eventorganiser_pre_gateway_checkout_paypal', 'set_my_custom_return_url', 10, 2 );
function set_my_custom_return_url( $cart, $booking ){

     //In case redirect depends on booking or event information:
     $booking_id = $booking['booking_id'];
     $event_id = $booking['event_id'];
     $occurrence_id = $booking['occurrence_id'];

     $cart['return'] = '';

     //Don't forget to return the $cart;
     return $cart;