Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Is there a way for me when a new customer creates and account to go to a different page other that the shipping page?
I am trying to use an app for wishlist but if they dont have an account it wants one created, problem is when they create it, it takes them to shipping info. That is not acceptable. I want them to go back to item or to the general wishlist.
Solved! Go to the solution
This is an accepted solution.
You can try placing the following script before the closing </body> tag in theme.liquid:
<script>
(function() {
var REDIRECT_PATH = '/checkout';
var selector = '#create_customer, form[action$="/account"][method="post"]',
$form = document.querySelectorAll(selector)[0];
if ($form) {
$redirect = document.createElement('input');
$redirect.setAttribute('name', 'return_to');
$redirect.setAttribute('type', 'hidden');
$redirect.value = REDIRECT_PATH;
$form.appendChild($redirect);
}
})();
</script>
Just replace the REDIRECT_PATH with the URL you would like people to be redirected to when they sign up with a new account.
This is an accepted solution.
You can try placing the following script before the closing </body> tag in theme.liquid:
<script>
(function() {
var REDIRECT_PATH = '/checkout';
var selector = '#create_customer, form[action$="/account"][method="post"]',
$form = document.querySelectorAll(selector)[0];
if ($form) {
$redirect = document.createElement('input');
$redirect.setAttribute('name', 'return_to');
$redirect.setAttribute('type', 'hidden');
$redirect.value = REDIRECT_PATH;
$form.appendChild($redirect);
}
})();
</script>
Just replace the REDIRECT_PATH with the URL you would like people to be redirected to when they sign up with a new account.
Thanks so much 🙏🏽. Worked great!