Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save actual-saurabh/01205e9856167e973c53062c22ddff31 to your computer and use it in GitHub Desktop.
Save actual-saurabh/01205e9856167e973c53062c22ddff31 to your computer and use it in GitHub Desktop.
Redirect customers to custom urls in LifterLMS after checkout
<?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