Instead of displaying the message of limit reached. Redirect to the other page with the product download button. It's possible?
Home > Community > Forums > Free Downloads WooCommerce Pro
Redirect with download button
Posted by: ANDERSON CANTILLO
20th October 2020, 10:19 pm
-
Hi Anderson, I replied to your email about this but didn't hear back. Here's my reply:
Hi mate, the default behaviour is the user gets redirected to the product page and the download limit reached message shows up on there.
What is it that you want to do differently?
-
When you reach the download limit the button will redirect to another page where you can buy the membership
-
Gotcha 👍
Leave it with me. There isn't a super easy way to do that right not, but I might be able to write a custom function you can add to your site.
-
Yes. Explain to me how you can change some code or how you can help me?
-
Richard. I hope you can help me as soon as possible.
-
I'll be looking at it today for you 🙂
-
Richard. I appreciate. You can send me to my mail. IF you find any way to do it from the plugin files?
Last modified: 21st October 2020, 8:02 am by ANDERSON CANTILLO
-
Hi Anderson,
It's easier to post here because of the formatting.
Here's the code you need. Install the plugin called Code Snippets, create a new snippet and paste the code in. Make sure you change the number for $page_id from 80 to the ID of the page you want to redirect users to.
add_action('template_redirect', 'free_downloads_custom_limit_reached_redirect', 99); function free_downloads_custom_limit_reached_redirect() { $somdn_errors = $_REQUEST['somdn_errors'] ?? ''; if (empty($somdn_errors)) { return; } $limit_reached = $somdn_errors[0]['download_limit_reached'] ?? ''; if (empty($limit_reached)) { return; } // ID number of the page to redirect the user to. $page_id = 80;// CHANGE THIS $page_url = get_the_permalink($page_id); $redirect_url = esc_url($page_url); wp_safe_redirect($redirect_url); exit; }
This topic is closed to new replies.
Latest Topics
-
Posted by M. Hogendoorn
19 Oct 2023, 7:27 pm -
Posted by Ryan
16 Oct 2023, 9:30 pm -
Posted by Adam
13 Oct 2023, 3:37 pm -
Posted by Vyacheslav Glebov
21 Sep 2023, 2:35 pm -
Posted by Alisa
4 Sep 2023, 9:15 pm
Most Fresh Topics
-
Posted by M. Hogendoorn
19 Oct 2023, 7:27 pm -
Posted by Adam
13 Oct 2023, 3:37 pm -
Posted by Ryan
16 Oct 2023, 9:30 pm -
Posted by Mark Preuss
19 Sep 2022, 1:37 pm -
Posted by Vyacheslav Glebov
21 Sep 2023, 2:35 pm
Most Popular Topics
-
Posted by M. Hogendoorn
7 Oct 2021, 11:11 am -
Posted by newoceans
2 Jan 2018, 10:19 pm -
Posted by Elio Bergamini
23 Nov 2020, 7:32 pm -
Posted by Jeremy
23 Jan 2021, 11:17 am -
Posted by Wayne Philips
2 Jul 2020, 6:34 pm
@ANDEROCK
10:19 pm