Relevant videos: How to automatically redirect users from any page to any page, website or domain in WordPress: ruclips.net/video/7ZtnlkP0f08/видео.html How to redirect users to different pages based on which products they purchase after checkout in WooCommerce: ruclips.net/video/W7YRxqYhBeY/видео.html How to create a child theme in WordPress: ruclips.net/video/iRGn5Ypm1qw/видео.html The function required to do this 👇 /** * Redirect WooCommerce to a custom page after checkout */ add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout'); function reialesa_redirect_woo_checkout( $order_id ){ $order = wc_get_order( $order_id ); $url = 'your URL here'; if ( ! $order->has_status( 'failed' ) ) { wp_safe_redirect( $url ); exit; } }
Hi, great video, thanks! Question: How do I make sure there is no other way to get to the 'Thank you' page other than through redirection after purchase? How do I prevent this page from appearing accidentally in Google search results? Thanks again.
Hi! Thank you for the kind words. The easiest way to prevent people from finding the page is making sure the link doesn't appear anywhere where somebody can click on it. You can also set the link to something you're sure nobody will ever accidentally find. With that said, I doubt anyone will go around looking for that specific page, so I wouldn't worry too much if I were you. You can prevent the page from appearing in Google search results by using an SEO plugin such as Rank Math and making sure the page is set to ''No index''. That way, search engines won't index the page and it won't appear in search results. For more information, I recommend you check out this article: rankmath.com/kb/how-to-noindex-urls/
Update: Now I got it to work. First I tried to redirect to a different website and it did not work. Now I set up a redirection to the same website and it worked. Thanks again!
Thanks for letting me know! Indeed, this only works for the pages of the website you use it on, not for redirecting to different, external websites. I'm very happy you managed to get it up and running! 💪
Amazing, it worked. thanks, it's a request that I want that user should only see thankyou page when redirected from checkout only and redirect to 404 when they try to access directly from url
Awesome, I'm happy to hear that. When it comes to blocking users from accessing the page directly, I think the easiest solution is to just leave it be. It's very unlikely anyone will actively go looking for a thank you page. On the off chance anyone does, it isn't a big deal if they have access to the page either. It's a good question, however, the only relevant information I've been able to find is this: stackoverflow.com/questions/19791037/disable-direct-access-to-a-wordpress-page Alternatively, you could try forcing users to log in before they are able to buy something and you could hide the page for users that aren't logged in. However, I wouldn't recommend that. Thank you for your support! 💪
Correct me if I'm wrong, but that's likely because you're trying to link to another website, not another page. The page you redirect to needs to be a part of the website where the user is making the purchase.
Hello! Here's how you can do exactly that: ruclips.net/video/W7YRxqYhBeY/видео.html If you have a lot of products, however, I'd recommend looking for a good plugin to do this.
@@narrayandeluck4188 I took plugin "Thank You Page for WooCommerce". With that you can add thank you page in your product section, where you put price. You can make thank you page and add that URL there.
There are quite a few possible reasons for that. If your permissions are all okay, it's most likely that a security plugin is hiding it. Disabling those options within the security plugin should allow you to access the Theme File Editor. Where they are depends on the plugin you're using. For the other possible reasons, this article explains it better than I could within a comment: nichetwins.com/wordpress-theme-editor-missing/
That's a good question. The way I would approach it is by using a high quality membership plugin. Then, I would just redirect them to the proper page, which would otherwise be inaccessible to non-logged in users. Another alternative is to redirect them to a page that would contain a clickable link that would then take them to the proper page. You could redirect them to the page directly, without a membership plugin, but that would mean anyone could access it. I also have a video on how you can redirect users to different pages based on the different products they purchase: ruclips.net/video/W7YRxqYhBeY/видео.html I hope my answer was helpful. Let me know how it goes! 💪
Sorry about that! RUclips won't let me post it in the description because of the ''angled brackets'' and the pinned comment is acting up. Sometimes it shows up correctly, sometimes it doesn't. Anyhow, here it is: /** * Redirect WooCommerce to a custom page after checkout */ add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout'); function reialesa_redirect_woo_checkout( $order_id ){ $order = wc_get_order( $order_id ); $url = 'your URL here'; if ( ! $order->has_status( 'failed' ) ) { wp_safe_redirect( $url ); exit; } }
The way I would do it is by using Elementor's purchase summary widget. That's gonna be the easiest and the fastest way. If you're not using Elementor or a page builder that offers this functionality, you'll have to find and use the appropriate WooCommerce hooks and then style the page via CSS. The other alternatives are styling the default checkout page with CSS or buying the official WooCommerce plugin (WooCommerce Custom Thank You Pages), but I've never used it so I can't say if it's worth it.
Hello! Thank you for your awesome comment, I'm glad the video was helpful. If by ''child editor'' you mean a child theme, it's quite simple. Here's how you can create a child theme: ruclips.net/video/iRGn5Ypm1qw/видео.html
It works, thank you very much for sharing this video. I have a question, is it possible to redirect to your custom page after Thank you page or Order details page ?
Hello! Awesome, I'm glad it helped. Redirecting to other pages from a new page is something I would do with a link or a button, so users have control over when it happens. So, use this to redirect them to whichever page and then on that page, include a link to where you want them to go next. The other way would be by using JavaScript so they get redirected automatically after a set amount of time, here's an example of how to do this: ruclips.net/video/7ZtnlkP0f08/видео.html
For that, this likely isn't the best way. A better way would be to style the original thank you page and change out the content or, the easier way (usually), use whichever method your page builder allows. For example, I use Elementor and in Elementor, I would just add in the ''Purchase Summary'' widget to my page and set that page as the ''Purchase Summary'' page in my Site Settings. That would mean that page is the page that gets redirected to when an order is made, it would include the order details and I can add in any content I want and style everything however I want. Of course, that means you don't need the method shown in the video. The method shown in the video is perfect for setting thank you pages that are disconnected from the actual usual checkout process or for page builders that don't have that option. If that applies to your situation, you can try adding in the shortcode [woocommerce_checkout] to your page but I'm not sure how effective the combination is going to be. Let me know how it goes! 💪
Indeed! If you can avoid an extra plugin with something like this, which I feel is easier than actually setting up the plugin in the first place, it's a win-win situation. Thank you for your support.
hey again, i updated my them and tried to re-do the code again as it worked after you help last time, but now after disabling the security plugins like last time its still not working??
Okay, let's start from the beginning. 1. Which theme are you using? 2. Are you using a child theme? 3. Try to install a file manager plugin (Advanced File Manager for example), then try adding the code inside the functions.php file via that plugin directly (wp-content > themes > your child theme > functions.php > right click and edit). Don't forget to backup first 😁
@@Reialesa I'm using the Divi theme, but I can't seem to find a child Divi theme. As you mentioned in the vid I presume this is the issue when updated the theme, I restored my backup to get back to when it was working so would it be ok if I just don't update my theme?
Okay, so that's likely the issue. The best way to go about this is to install a plugin called Child Theme Configurator. Then, using the plugin, create a child theme, it's very simple. If you get stuck, my ''Elementor Beginner Tutorial'' video shows how it's done at around 3 minutes 30 seconds. Next, activate the child theme (you can also uninstall the plugin after you create the child theme). The next step is to edit the functions.php again and in your case, you might have to disable the security plugin to do so, just like you did the first time. If you aren't using a child theme, all of the changes you make to a theme disappear when it gets updated. I wouldn't recommend simply not updating your theme because some updates may be very important, so a child theme is the perfect solution.
@@Reialesa I tried that and it didn't work, I'm not using elementaor builder I'm using the divi builder and what do I do once I've activates the child theme plugin as nothing seems to change once I installed it ?
Interesting question! I actually did some testing and it always stays on the checkout page in my experience. Which is, honestly, likely the best way to go about it - if your user makes a typo while trying to make a purchase, you probably don't want them to be redirected and have to go through the whole process again. I wish I had a more specific answer for you but at this time, I can't seem to find a viable way to make this happen.
hey bro, when I do this it says this, "Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP." how do I fix it and get it to work?
Hello! I've never encountered this issue, but here's what I've gathered from doing some research; first off, I'd try disabling any security plugin you have and see if that helps (don't forget to enable it back). It could also be theme permissions or other plugins causing the issue. Otherwise, you'll probably have to edit the files with something like FileZilla. I recommend you copy the error into Google and go off that, lots of cases of this issue popping up. Let me know how it goes!
it's not working for me , I get this message " Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP."
Try disabling any security plugins you have and see if that helps (don't forget to enable them back afterwards). It could also be because of a certain plugin or because of theme permissions. If none of these work, edit the files directly via cPanel or, if you don't have cPanel, try using something like FileZilla to edit them. If all else fails, I recommend copying the error into Google as you'll find many people have this issue for many different reasons. Let me know how it goes!
But Mate what If I have added my paypment Gateway Pyapal so Obviusly when some one fill information on Checkout it will redirect them to thier paypal Right how can I redirect buyer to my Thank you page when client succesfully paid from Paypal
Good question. That's something I haven't tried to do yet but it seems like something you have to set up directly in PayPal. I found this and I think it will help you out: www.paypal.com/us/cshelp/article/FAQ3651 Let me know how it goes! 💪
Sorry about that! RUclips won't let me post it in the description because of the ''angled brackets'' and the pinned comment is acting up. Sometimes it shows up correctly, sometimes it doesn't. Anyhow, here it is: /** * Redirect WooCommerce to a custom page after checkout */ add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout'); function reialesa_redirect_woo_checkout( $order_id ){ $order = wc_get_order( $order_id ); $url = 'your URL here'; if ( ! $order->has_status( 'failed' ) ) { wp_safe_redirect( $url ); exit; } }
Hello! It's available in the pinned comment. Here it is 👇 /** * Redirect WooCommerce to a custom page after checkout */ add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout'); function reialesa_redirect_woo_checkout( $order_id ){ $order = wc_get_order( $order_id ); $url = 'your URL here'; if ( ! $order->has_status( 'failed' ) ) { wp_safe_redirect( $url ); exit; } }
Good question. I'd imagine it shouldn't affect your analytics or ads in most cases but I can't say for sure. For example, if, in your ads, your conversion event is simply your users arriving at the thank you page, it shouldn't be a problem. For others, I can't say for sure. The very best (and pretty much the only) way to figure out how it affects your analytics or advertising efforts is to thoroughly test it out for your specific website.
I try but it says "Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP." I use multi site and try to implement it in the main dashboard please guide me :)
Hi! Unfortunately, I've never used multisite before but I can try to speculate why this doesn't work. This is based on redirecting to a specific thank you page and because of that, it will not work for redirecting to external websites or domains, so it will only work for one website at a time. So, if you add it to your multisite functions.php file, it adds it to all of them at once and you get the error. What I recommend you do is try to find a way to insert the code to just one website. The first thing I would try is creating child themes for every individual website. After you do that, technically, every website should be able to have its own functions.php file. After that, you can just add in your code to the appropriate child theme. I would recommend using a plugin called ''Child Theme Configurator'' to do this. I have a video on how to set it up on my channel. More about using the child themes here: wordpress.stackexchange.com/questions/81886/wordpress-multisite-multiple-child-theme If that doesn't work, here's another, more complicated, way you can try: stackoverflow.com/questions/28656909/wordpress-multisite-add-function-to-functions-php-to-only-affect-1-site I hope this was helpful. Good luck and let me know how it goes! 💪
Here you go (you can also find it in the pinned comment): The function required to do this 👇 /** * Redirect WooCommerce to a custom page after checkout */ add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout'); function reialesa_redirect_woo_checkout( $order_id ){ $order = wc_get_order( $order_id ); $url = 'your URL here'; if ( ! $order->has_status( 'failed' ) ) { wp_safe_redirect( $url ); exit; } }
Hi. It's available in the pinned comment. Here it is 👇 /** * Redirect WooCommerce to a custom page after checkout */ add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout'); function reialesa_redirect_woo_checkout( $order_id ){ $order = wc_get_order( $order_id ); $url = 'your URL here'; if ( ! $order->has_status( 'failed' ) ) { wp_safe_redirect( $url ); exit; } }
Hi! Looks like the pinned comment is acting up again. Sometimes it shows up correctly, sometimes it doesn't. Anyhow, here it is: /** * Redirect WooCommerce to a custom page after checkout */ add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout'); function reialesa_redirect_woo_checkout( $order_id ){ $order = wc_get_order( $order_id ); $url = 'your URL here'; if ( ! $order->has_status( 'failed' ) ) { wp_safe_redirect( $url ); exit; } }
Hey, I need to redirect to external URL but once I input that, once I do the payments, it redirects me to wp-admin page. Is this only for internal linking? Maybe to add more context. I'm on Breakdance builder so no child theme. I'm using Advanced Scripts to store and execute code.
I created a new video that explains how you can automatically redirect to any (external) website in WordPress. And, of course, you can use it to redirect your users after checkout as well. Here's the video: ruclips.net/video/7ZtnlkP0f08/видео.html
Hello! It's available in the pinned comment. Here it is 👇 /** * Redirect WooCommerce to a custom page after checkout */ add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout'); function reialesa_redirect_woo_checkout( $order_id ){ $order = wc_get_order( $order_id ); $url = 'your URL here'; if ( ! $order->has_status( 'failed' ) ) { wp_safe_redirect( $url ); exit; } }
I'm happy to help, thank you for your support, I appreciate it! 💪 I've never used the Code Snippets plugin, but as far as I can tell, that's exactly what it's for, so it should work just fine. Let me know how it goes! 🤞
Hi! Here it is (you can also find it in the pinned comment) 👇 /** * Redirect WooCommerce to a custom page after checkout */ add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout'); function reialesa_redirect_woo_checkout( $order_id ){ $order = wc_get_order( $order_id ); $url = 'your URL here'; if ( ! $order->has_status( 'failed' ) ) { wp_safe_redirect( $url ); exit; } }
Awesome content 😁Anybody any idea on how to implement with multilanguage Wordpress shop? using polylang for woocommerce and want to redirect to static page according to language setting of user
Great question. I would assume the page gets translated, just like any other page, if the user chose a specific language. For example, I'm using TranslatePress and when somebody visits the Slovenian version of my website, the URL is reialesa.com/sl/. Any page they then visit has /sl/ in the URL as well, for example, reialesa.com/sl/branding. Meaning, every other page they visit is also translated. I haven't worked with Polylang yet but I assume the way it works is similar, if not the same. So, I also assume the thank you page should work like other pages and get automatically redirected to the correct language like other pages. I found this and, after giving it a quick read, I think your issue is connected to the way Polylang approaches URLs: polylang.wordpress.com/documentation/setting-up-a-wordpress-multilingual-site-with-polylang/settings/ I recommend you go through it, it just might give you the answers you need. Thank you very much for your support and kind words! 🙌
I can't make any promises but as soon as I find something worth making a video about, I'll make it! WooCommerce is a very extensive topic, so I'm sure something will come up sooner rather than later.
Relevant videos:
How to automatically redirect users from any page to any page, website or domain in WordPress: ruclips.net/video/7ZtnlkP0f08/видео.html
How to redirect users to different pages based on which products they purchase after checkout in WooCommerce: ruclips.net/video/W7YRxqYhBeY/видео.html
How to create a child theme in WordPress: ruclips.net/video/iRGn5Ypm1qw/видео.html
The function required to do this 👇
/**
* Redirect WooCommerce to a custom page after checkout
*/
add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout');
function reialesa_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = 'your URL here';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
Thanks for putting the code here! Really simplifies our process in understanding and testing the code through functions.php out. 😁✨
More than happy to help! Thank you for your support 💪
how if failed purchase that same redirect to thank you page?
Hi, great video, thanks! Question: How do I make sure there is no other way to get to the 'Thank you' page other than through redirection after purchase? How do I prevent this page from appearing accidentally in Google search results? Thanks again.
Hi! Thank you for the kind words. The easiest way to prevent people from finding the page is making sure the link doesn't appear anywhere where somebody can click on it. You can also set the link to something you're sure nobody will ever accidentally find. With that said, I doubt anyone will go around looking for that specific page, so I wouldn't worry too much if I were you.
You can prevent the page from appearing in Google search results by using an SEO plugin such as Rank Math and making sure the page is set to ''No index''. That way, search engines won't index the page and it won't appear in search results. For more information, I recommend you check out this article: rankmath.com/kb/how-to-noindex-urls/
Your channel is hugely undervalued. Quality is really good bro
Thank you, I really appreciate that, it means a lot! 🙏🙌
Update: Now I got it to work. First I tried to redirect to a different website and it did not work. Now I set up a redirection to the same website and it worked. Thanks again!
Thanks for letting me know! Indeed, this only works for the pages of the website you use it on, not for redirecting to different, external websites. I'm very happy you managed to get it up and running! 💪
But how to add things like "order details" in the custom made page?
Amazing, it worked. thanks, it's a request that I want that user should only see thankyou page when redirected from checkout only and redirect to 404 when they try to access directly from url
Awesome, I'm happy to hear that. When it comes to blocking users from accessing the page directly, I think the easiest solution is to just leave it be. It's very unlikely anyone will actively go looking for a thank you page. On the off chance anyone does, it isn't a big deal if they have access to the page either.
It's a good question, however, the only relevant information I've been able to find is this: stackoverflow.com/questions/19791037/disable-direct-access-to-a-wordpress-page
Alternatively, you could try forcing users to log in before they are able to buy something and you could hide the page for users that aren't logged in. However, I wouldn't recommend that.
Thank you for your support! 💪
How do I display the customers order number on the thank you page?
This is whwt im looking for but after your instructions are followed and tested, it takes me to woocomerce log in page
Correct me if I'm wrong, but that's likely because you're trying to link to another website, not another page. The page you redirect to needs to be a part of the website where the user is making the purchase.
Hello, can the redirection be different for different products?
Hello! Here's how you can do exactly that: ruclips.net/video/W7YRxqYhBeY/видео.html If you have a lot of products, however, I'd recommend looking for a good plugin to do this.
I don't have Appearance - Theme File Editor. I tryed it with Code Snippets but it dosn't work there.
The same here. Did you find out how to fix it?
@@narrayandeluck4188 I took plugin "Thank You Page for WooCommerce". With that you can add thank you page in your product section, where you put price. You can make thank you page and add that URL there.
There are quite a few possible reasons for that. If your permissions are all okay, it's most likely that a security plugin is hiding it. Disabling those options within the security plugin should allow you to access the Theme File Editor. Where they are depends on the plugin you're using.
For the other possible reasons, this article explains it better than I could within a comment: nichetwins.com/wordpress-theme-editor-missing/
Question: how can I re-direct my customer to my Download page for videos where they can get different downloads after they pay???
Thanks.
That's a good question. The way I would approach it is by using a high quality membership plugin. Then, I would just redirect them to the proper page, which would otherwise be inaccessible to non-logged in users. Another alternative is to redirect them to a page that would contain a clickable link that would then take them to the proper page. You could redirect them to the page directly, without a membership plugin, but that would mean anyone could access it.
I also have a video on how you can redirect users to different pages based on the different products they purchase: ruclips.net/video/W7YRxqYhBeY/видео.html
I hope my answer was helpful. Let me know how it goes! 💪
I have downloadable products and it doesn't seem to work in my case. Any insight?
i dont see the code - where is it located?
Where is the code? Can't find it down below and Ive scrolled passed Australia 😅
Sorry about that! RUclips won't let me post it in the description because of the ''angled brackets'' and the pinned comment is acting up. Sometimes it shows up correctly, sometimes it doesn't. Anyhow, here it is:
/**
* Redirect WooCommerce to a custom page after checkout
*/
add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout');
function reialesa_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = 'your URL here';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
thx, redirect works, but it doesn't show the woocommerce order summary, how can we add that also?
The way I would do it is by using Elementor's purchase summary widget. That's gonna be the easiest and the fastest way. If you're not using Elementor or a page builder that offers this functionality, you'll have to find and use the appropriate WooCommerce hooks and then style the page via CSS. The other alternatives are styling the default checkout page with CSS or buying the official WooCommerce plugin (WooCommerce Custom Thank You Pages), but I've never used it so I can't say if it's worth it.
what if i have multiple products
If you mean redirecting your user based on which product they purchase, here's how you can do that: ruclips.net/video/W7YRxqYhBeY/видео.html
my dear friend thank you for your support. love from INDIA
Right back at you, thank you! 🙏
Hello Reialesa, how do I redirect to a thank you page for a specific product only and not all products in general?
Hi! I have a video that will help you do exactly that: ruclips.net/video/W7YRxqYhBeY/видео.html
Let me know how it goes! 💪
Great, simple tutorial 👌
I was wondering, how do I get a "child editor"? Im currently using divi
Hello! Thank you for your awesome comment, I'm glad the video was helpful. If by ''child editor'' you mean a child theme, it's quite simple. Here's how you can create a child theme: ruclips.net/video/iRGn5Ypm1qw/видео.html
I am trying to add custom cta on the top of checkout page, did everything but still nothing works. Need help!
It works, thank you very much for sharing this video.
I have a question, is it possible to redirect to your custom page after Thank you page or Order details page ?
Hello! Awesome, I'm glad it helped. Redirecting to other pages from a new page is something I would do with a link or a button, so users have control over when it happens. So, use this to redirect them to whichever page and then on that page, include a link to where you want them to go next. The other way would be by using JavaScript so they get redirected automatically after a set amount of time, here's an example of how to do this: ruclips.net/video/7ZtnlkP0f08/видео.html
@@Reialesa Thank you very much for sharing this, i'll try this method.
thanks it worked no issues nice explanation
Awesome, that's great to hear. Thank you for your support! 🙏
Where is code? Could you please give me the code?
Hi! Here it is 👇
/**
* Redirect WooCommerce to a custom page after checkout
*/
add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout');
function reialesa_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = 'your URL here';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
Thanks its working for me baba ji its working love you to hogya 😂❤🎉
I'm happy to hear it's working for you, thank you for your support! 🙌
My Thank you page is blank and I want to show the order details. Any tips on how to fix this?
For that, this likely isn't the best way. A better way would be to style the original thank you page and change out the content or, the easier way (usually), use whichever method your page builder allows. For example, I use Elementor and in Elementor, I would just add in the ''Purchase Summary'' widget to my page and set that page as the ''Purchase Summary'' page in my Site Settings. That would mean that page is the page that gets redirected to when an order is made, it would include the order details and I can add in any content I want and style everything however I want.
Of course, that means you don't need the method shown in the video.
The method shown in the video is perfect for setting thank you pages that are disconnected from the actual usual checkout process or for page builders that don't have that option.
If that applies to your situation, you can try adding in the shortcode [woocommerce_checkout] to your page but I'm not sure how effective the combination is going to be. Let me know how it goes! 💪
ITS WORKING ! THANK YOU
That's awesome, thank you for your support 💪
Oh. Thank you very much bro. It is important reduce installing any plugins, which reduces speed of website.
Indeed! If you can avoid an extra plugin with something like this, which I feel is easier than actually setting up the plugin in the first place, it's a win-win situation. Thank you for your support.
So Simple, But IT WORKS !! THANK YOU SO MUCH.
Happy to help, thank you for your awesome comment! 🙌
Unfortunately it's not working for me.
What If I want to add different thank you pages for different products checkout
Hello! I have a video that will show you how to do exactly that. Here it is: ruclips.net/video/W7YRxqYhBeY/видео.html
Worked perfectly, thank you!
Awesome 🤜🤛 Glad I could help!
hey again, i updated my them and tried to re-do the code again as it worked after you help last time, but now after disabling the security plugins like last time its still not working??
Okay, let's start from the beginning. 1. Which theme are you using? 2. Are you using a child theme? 3. Try to install a file manager plugin (Advanced File Manager for example), then try adding the code inside the functions.php file via that plugin directly (wp-content > themes > your child theme > functions.php > right click and edit). Don't forget to backup first 😁
@@Reialesa I'm using the Divi theme, but I can't seem to find a child Divi theme. As you mentioned in the vid I presume this is the issue when updated the theme, I restored my backup to get back to when it was working so would it be ok if I just don't update my theme?
Okay, so that's likely the issue. The best way to go about this is to install a plugin called Child Theme Configurator. Then, using the plugin, create a child theme, it's very simple. If you get stuck, my ''Elementor Beginner Tutorial'' video shows how it's done at around 3 minutes 30 seconds. Next, activate the child theme (you can also uninstall the plugin after you create the child theme). The next step is to edit the functions.php again and in your case, you might have to disable the security plugin to do so, just like you did the first time. If you aren't using a child theme, all of the changes you make to a theme disappear when it gets updated. I wouldn't recommend simply not updating your theme because some updates may be very important, so a child theme is the perfect solution.
@@Reialesa brilliant, I'll give that a go and let you know if it doesn't work. Thanks heaps mate your a legend !
@@Reialesa I tried that and it didn't work, I'm not using elementaor builder I'm using the divi builder and what do I do once I've activates the child theme plugin as nothing seems to change once I installed it ?
What if the payment fails? How´d be the code to redirect people to a
"failed payment" url??
Interesting question! I actually did some testing and it always stays on the checkout page in my experience. Which is, honestly, likely the best way to go about it - if your user makes a typo while trying to make a purchase, you probably don't want them to be redirected and have to go through the whole process again. I wish I had a more specific answer for you but at this time, I can't seem to find a viable way to make this happen.
hey bro, when I do this it says this,
"Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP."
how do I fix it and get it to work?
Hello! I've never encountered this issue, but here's what I've gathered from doing some research; first off, I'd try disabling any security plugin you have and see if that helps (don't forget to enable it back). It could also be theme permissions or other plugins causing the issue. Otherwise, you'll probably have to edit the files with something like FileZilla. I recommend you copy the error into Google and go off that, lots of cases of this issue popping up. Let me know how it goes!
@@Reialesa thanks bro, I'll give those a try
Thanks for this. It is exactly what I'm looking to do.
Awesome, glad I could help!
Hi, how can I access the default WooCommerce thank you page?
You should try making a test purchase. If you're using Stripe, enable the 'Test' mode and make a purchase. It will redirect you to the default page.
it's not working for me , I get this message " Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP."
Try disabling any security plugins you have and see if that helps (don't forget to enable them back afterwards). It could also be because of a certain plugin or because of theme permissions. If none of these work, edit the files directly via cPanel or, if you don't have cPanel, try using something like FileZilla to edit them. If all else fails, I recommend copying the error into Google as you'll find many people have this issue for many different reasons. Let me know how it goes!
Love this! how to I redirect to a different page per product?
I'm glad you like it! To redirect to different pages based on the product purchased, check out this video: ruclips.net/video/W7YRxqYhBeY/видео.html
It's worked. Thank you
That's great to hear, thank you for your support! 🙌
Bravo, samo naprijed 👍🏻
Hvala! 💪
But Mate what If I have added my paypment Gateway Pyapal so Obviusly when some one fill information on Checkout it will redirect them to thier paypal Right how can I redirect buyer to my Thank you page when client succesfully paid from Paypal
Good question. That's something I haven't tried to do yet but it seems like something you have to set up directly in PayPal.
I found this and I think it will help you out: www.paypal.com/us/cshelp/article/FAQ3651
Let me know how it goes! 💪
Where is the code? I can't see it anywhere, did you take it off?
Sorry about that! RUclips won't let me post it in the description because of the ''angled brackets'' and the pinned comment is acting up. Sometimes it shows up correctly, sometimes it doesn't. Anyhow, here it is:
/**
* Redirect WooCommerce to a custom page after checkout
*/
add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout');
function reialesa_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = 'your URL here';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
I cant locate the code with the function in the description
Hello! It's available in the pinned comment. Here it is 👇
/**
* Redirect WooCommerce to a custom page after checkout
*/
add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout');
function reialesa_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = 'your URL here';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
Doesn't it mess up with meta pixel and google analytics?
Good question. I'd imagine it shouldn't affect your analytics or ads in most cases but I can't say for sure. For example, if, in your ads, your conversion event is simply your users arriving at the thank you page, it shouldn't be a problem. For others, I can't say for sure. The very best (and pretty much the only) way to figure out how it affects your analytics or advertising efforts is to thoroughly test it out for your specific website.
Thank you this helped me out quite a bit.
I'm very happy you found the video helpful. Thank you for your support, I appreciate it! 🙌🙏
I try but it says "Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP."
I use multi site and try to implement it in the main dashboard
please guide me :)
Hi! Unfortunately, I've never used multisite before but I can try to speculate why this doesn't work. This is based on redirecting to a specific thank you page and because of that, it will not work for redirecting to external websites or domains, so it will only work for one website at a time. So, if you add it to your multisite functions.php file, it adds it to all of them at once and you get the error. What I recommend you do is try to find a way to insert the code to just one website.
The first thing I would try is creating child themes for every individual website. After you do that, technically, every website should be able to have its own functions.php file. After that, you can just add in your code to the appropriate child theme. I would recommend using a plugin called ''Child Theme Configurator'' to do this. I have a video on how to set it up on my channel. More about using the child themes here: wordpress.stackexchange.com/questions/81886/wordpress-multisite-multiple-child-theme
If that doesn't work, here's another, more complicated, way you can try: stackoverflow.com/questions/28656909/wordpress-multisite-add-function-to-functions-php-to-only-affect-1-site
I hope this was helpful. Good luck and let me know how it goes! 💪
doesn't work , it redirects me on my own admin wp website? any solutions? thanks in advance
Hi! That happens if you try to redirect to another website. This only works for redirecting to different pages, not external websites.
where is the code?
Here you go (you can also find it in the pinned comment):
The function required to do this 👇
/**
* Redirect WooCommerce to a custom page after checkout
*/
add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout');
function reialesa_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = 'your URL here';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
where is the code
Hi. It's available in the pinned comment. Here it is 👇
/**
* Redirect WooCommerce to a custom page after checkout
*/
add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout');
function reialesa_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = 'your URL here';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
Thank you very much. From Bangladesh.
Thank you so much bro
Thank you my man
Happy to help, thank you for the kind comment! 💪
where i can download the php code?
Hi! Looks like the pinned comment is acting up again. Sometimes it shows up correctly, sometimes it doesn't. Anyhow, here it is:
/**
* Redirect WooCommerce to a custom page after checkout
*/
add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout');
function reialesa_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = 'your URL here';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
Hey, I need to redirect to external URL but once I input that, once I do the payments, it redirects me to wp-admin page. Is this only for internal linking?
Maybe to add more context. I'm on Breakdance builder so no child theme. I'm using Advanced Scripts to store and execute code.
Hi! You're quite right, this only works for internal linking and redirecting to different pages, not different websites.
@@Reialesa thanks. Makes sense now.
I created a new video that explains how you can automatically redirect to any (external) website in WordPress. And, of course, you can use it to redirect your users after checkout as well. Here's the video: ruclips.net/video/7ZtnlkP0f08/видео.html
dont find the code...
Hello! It's available in the pinned comment. Here it is 👇
/**
* Redirect WooCommerce to a custom page after checkout
*/
add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout');
function reialesa_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = 'your URL here';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
Thank you so much for this video! It helped me a lot!!!
Awesome, I'm really glad you found it helpful! 💪
Thanks. Sub!
Can I use Code Snippet plugign with this? I like to have all my custom codes in one place.
I'm happy to help, thank you for your support, I appreciate it! 💪 I've never used the Code Snippets plugin, but as far as I can tell, that's exactly what it's for, so it should work just fine. Let me know how it goes! 🤞
@@Reialesa Will do. No problem with the support.
quick and easy. Thank you!
I'm happy to help, thank you for your support, I appreciate it! 🙏
Legend!
Thank you, right back at you! 🙌
Perfect, thank u🎉
Thank you for your support! 😄🙌
How to find code
Hi! Here it is (you can also find it in the pinned comment) 👇
/**
* Redirect WooCommerce to a custom page after checkout
*/
add_action( 'woocommerce_thankyou', 'reialesa_redirect_woo_checkout');
function reialesa_redirect_woo_checkout( $order_id ){
$order = wc_get_order( $order_id );
$url = 'your URL here';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
Awesome content 😁Anybody any idea on how to implement with multilanguage Wordpress shop? using polylang for woocommerce and want to redirect to static page according to language setting of user
Great question. I would assume the page gets translated, just like any other page, if the user chose a specific language. For example, I'm using TranslatePress and when somebody visits the Slovenian version of my website, the URL is reialesa.com/sl/. Any page they then visit has /sl/ in the URL as well, for example, reialesa.com/sl/branding. Meaning, every other page they visit is also translated.
I haven't worked with Polylang yet but I assume the way it works is similar, if not the same. So, I also assume the thank you page should work like other pages and get automatically redirected to the correct language like other pages.
I found this and, after giving it a quick read, I think your issue is connected to the way Polylang approaches URLs: polylang.wordpress.com/documentation/setting-up-a-wordpress-multilingual-site-with-polylang/settings/
I recommend you go through it, it just might give you the answers you need.
Thank you very much for your support and kind words! 🙌
Thank you!
not work brother🙁🙁
I'm sorry to hear that! Could you please provide a little more information? What happens after the purchase is completed?
Thank you very much! :)
You are very welcome! Thank you for your support. 🙌
Thanks bro it helps me alot
I'm happy to hear that, thank you for your support! 🙏
Thank you so Much, You save my time thanks
That is great to hear, I'm happy to help. Thank you for your support! 🙌
available down below @ 0:45 where in australia? ffs!
You're right, I just noticed the pinned comment isn't always displaying correctly. It's most likely a bug, hopefully it gets fixed soon! 🤞
Thank youuuuuuuuu thank you very very veeeeeeryyyyyyy much 😁😍
You are very welcome, I'm glad the video was helpful! 💪
Thank you so much
Thank you for your support 👐
Thankss, verry helpful
It's great to hear you found the video helpful, thank you for your support! 🙌
Thank you
Happy to help! 🙌
thanks sir...
You're very welcome, thank you for your support!
Simple ❤
Glad you liked it!
Please make more wocommerce videos
I can't make any promises but as soon as I find something worth making a video about, I'll make it! WooCommerce is a very extensive topic, so I'm sure something will come up sooner rather than later.
Great
thanks
Happy to help, thank you for your support 🙏
thank you !