Last active
January 20, 2018 00:03
-
-
Save thomasplevy/6e5aeec68599e7086b0008cd241f7a38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // don't add this line to your functions.php file | |
/** | |
* Redirect a user after sucessfully purchasing a course or membership | |
* @param string $url default url | |
* @param obj $order instance of LLMS_Order | |
* @return string | |
*/ | |
function my_llms_checkout_redirect( $url, $order ) { | |
// if you want to change the destination based on the purchased product | |
if ( 123 == $order->get( 'product_id' ) ) { | |
$url = add_query_arg( 'order-complete', $order->get( 'order_key' ), 'http://myurl.tld/product123startpage' ); | |
} | |
// go to the student dashboard | |
else { | |
$url = llms_get_page_url( 'myaccount', array( 'order-complete', $order->get( 'order_key' ) ) ); | |
} | |
return $url; | |
} | |
add_filter( 'lifterlms_completed_transaction_redirect', 'my_llms_checkout_redirect', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment