Different Success Page per EDD Download
Sends buyers of specific downloads to their own thank-you page after purchase, for example with setup instructions or an onboarding video.
Opens WPIDE on
Code
$wpide_edd_success_pages = array( // Download ID => page ID.
101 => 202,
);
add_filter( 'edd_success_page_redirect', function ( $redirect, $gateway, $query_string ) use ( $wpide_edd_success_pages ) {
$session = function_exists( 'edd_get_purchase_session' ) ? edd_get_purchase_session() : false;
foreach ( (array) ( $session['downloads'] ?? array() ) as $download ) {
$page = $wpide_edd_success_pages[ (int) ( $download['id'] ?? 0 ) ] ?? 0;
if ( $page && 'publish' === get_post_status( $page ) ) {
return get_permalink( $page ) . $query_string;
}
}
return $redirect;
}, 10, 3 );
Notes
The first matching download wins; add the [edd_receipt] shortcode to those pages to keep showing the receipt.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.