We have developed a login page for our wholesale customers with a login form and a custom checkout_url value specified:
<input type="hidden" name="checkout_url" value="/pages/wholesale-landing" />
It works great when the correct password is entered, but if incorrect, the user is redirected to:
/account/login?checkout_url=%2Fpages%2Fwholesale-landing
This is not what we need, as now the user is on the generic login page. Ideally, an incorrect password would show the default error on this same page.
I've looked all over and seen this topic mentioned but never answered, so I'm hoping someone has a solution example to share.
Solved! Go to the solution
This is an accepted solution.
Right after posting this, I noticed that since the checkout_url is added to a query at the end of /account/login, I could use that to solve the whole thing:
<script>
var refer = document.referrer;
var wrongpass = refer.includes("/account/login?checkout_url=%2Fpages%2Fcustom-login");
if (wrongpass) {
document.write("<p style='color:red; padding-top:10px'>INCORRECT PASSWORD</p>");
} else {
document.write("");
}
</script>
I sincerely hope this workaround helps someone trying to find this solution.
For other customer action redirects, it's explained here by Huratips: https://www.huratips.com/tech-tips/how-to-redirect-shopify-customer-to-specific-page-after-login-log.... A web search for "shopify redirect customer on login" would have found this for you.
Redirect customer on login
When a customer visits your online store and logs in to their account, they will see a My Account page that shows their past orders and associated shipping and billing addresses. You can edit your theme so that customers are taken to a different page when they log in.
User | Count |
---|---|
26 | |
22 | |
16 | |
9 | |
8 |