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.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/abstracts/abstract.llms.payment.gateway.php

	protected function get_complete_transaction_redirect_url( $order ) {

		// Get the redirect parameter.
		$redirect = urldecode( llms_filter_input( INPUT_GET, 'redirect', FILTER_VALIDATE_URL ) );

		// Redirect to the product's permalink, if no parameter was set.
		$redirect = ! empty( $redirect ) ? $redirect : get_permalink( $order->get( 'product_id' ) );

		// Fallback to the account page if we don't have a url for some reason.
		$redirect = ! empty( $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' );

		if ( get_current_user_id() && ( 'free_enroll' === $quick_enroll_form ) && ! empty( $free_checkout_redirect ) ) {
			$redirect = urldecode( $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 ) );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.30.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.