Created
October 30, 2018 15:44
-
-
Save actual-saurabh/01205e9856167e973c53062c22ddff31 to your computer and use it in GitHub Desktop.
Redirect customers to custom urls in LifterLMS after checkout
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 // Do not copy this line. | |
// Copy from under this line and paste into your child theme's functions.php. | |
// replace the default redirect_url. | |
add_filter( 'lifterlms_completed_transaction_redirect', 'llms_custom_checkout_post_checkout_redirection', 10, 2 ); | |
function llms_custom_checkout_post_checkout_redirection( $original_redirect, $order ) { | |
// only proceed if the order has been for a particualr membership. | |
if( (int) $order->get( 'product_id' ) !== 7078 ){ | |
return $original_redirect; | |
} | |
// custom url (could be pulled from the metadata of the product or access plan). | |
$redirection_url = 'https://customdomain.com/permalink/parts/'; | |
// return custom url instead. | |
return $redirection_url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment