When using the Subscriptions for WooCommerce plugin, you may want to redirect customers to a specific page after they have completed a subscription purchase. This article provides a code snippet that enables to achieve this custom redirection.
Follow the steps to redirect a customer to a custom page after a successful WooCommerce subscription purchase.
- Navigate to Appearance > Theme File Editor > functions.php file from the WordPress dashboard.
- Copy the code snippet provided below.
- Paste the code snippet into the functions.php file.
- Replace the URL “
http://www.webtoffee.com/
” with the desired page URL, where you want to redirect users. - Save the functions.php file.
You can also use a third-party plugin for adding the snippet. Click the below link to know more.
> Adding a Custom Code Snippet Using a Third-Party Plugin
Dan
April 15, 2021
We tested this using the one-time option (non-subscription) you can select on a subscription product using this plugin:
https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/
And even though it was not a subscription product, it redirected to the custom page.
Is there any modification to provide support?
Thanks in advance
Mark
April 16, 2021
Hi Dan,
The plugin you mention is developed by Woocommerce plugin and is designed to work with only the Woocommerce Subscription plugin. Sorry that we cannot help out.
James
February 8, 2021
Is this code ignored if the purchaser has purchased a non-subscription product?
Mark
February 15, 2021
Yes. It works only if the user purchases a subscription product.
Ramy Ezzedine
December 23, 2020
Hello,
Excellent code, it’s working well! Will you have a similar code for when you login and have an Active Subscription to redirect to a page?
Thank you!
Ramy
Mark
December 29, 2020
The code given in the article is to redirect while purchasing a subscription which is when the subscription becomes active.
Ramy
January 2, 2021
Hi Mark – yes that’s correct, I want to have a similar behavior for a user who already made his purchase, comes back to the site and login, he access directly a specific page.
Mark
January 25, 2021
Currently, we do not have a filter to achieve this. Sorry about that.
Diseño web Sevilla
February 4, 2020
Hi thanks for the post, but can it be done with some plugin. I.m trying in my web https://nosunelanube.com for a suscription and I have not knowledge about codes. Thanks