LLMS_Payment_Gateway::get_complete_transaction_redirect_url( LLMS_Order $order )
Calculates the url to redirect to on transaction completion.
Parameters Parameters
- $order
-
(LLMS_Order) (Required) The order object.
Return Return
(string)
Source Source
File: includes/abstracts/abstract.llms.payment.gateway.php
protected function get_complete_transaction_redirect_url( $order ) { // Get the redirect parameter from INPUT_GET. $redirect = urldecode( llms_filter_input( INPUT_GET, 'redirect', FILTER_VALIDATE_URL ) ?? '' ); // Get the redirect parameter from INPUT_POST if not INPUT_GET redirect pased. $redirect = $redirect ? $redirect : llms_filter_input( INPUT_POST, 'redirect', FILTER_VALIDATE_URL ); // Redirect to the product's permalink, if no redirect found yet. $redirect = $redirect ? $redirect : get_permalink( $order->get( 'product_id' ) ); // Fallback to the account page if we don't have a url for some reason. $redirect = $redirect ? $redirect : get_permalink( llms_get_page_id( 'myaccount' ) ); // Add order key to the url. $redirect = add_query_arg( array( 'order-complete' => $order->get( 'order_key' ), ), esc_url( $redirect ) ); // Redirection url on free checkout form. $quick_enroll_form = llms_filter_input( INPUT_POST, 'form' ); $free_checkout_redirect = llms_filter_input( INPUT_POST, 'free_checkout_redirect', FILTER_VALIDATE_URL ); if ( get_current_user_id() && ( 'free_enroll' === $quick_enroll_form ) && $free_checkout_redirect ) { $redirect = $free_checkout_redirect; } /** * Filters the redirect on order completion. * * @since 3.8.0 * * @param string $redirect The URL to redirect user to. * @param LLMS_Order $order The order object. */ return esc_url( apply_filters( 'lifterlms_completed_transaction_redirect', $redirect, $order ) ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
7.0.0 | Retrieve the redirect URL from the INPUT_POST if not passed via INPUT_GET. |
3.30.0 | Introduced. |