Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi - I'm creating a landing page for my new product. On the landing page I have an email form (email sign up section). I have it setup so when "if form.posted_successfully" the site redirects to another page on my site. This setup works great, but I want it to redirect to that page even if the customer puts in their email address again. I'm assuming it's because the form doesn't post successfully since the email address is already in the system as a customer.
Thanks!
Hey Sara,
i got the absolutely same issue^^
I got a landing page where the user can submit his email.
But if the User email is already inside the shopify backend then the variable: "form.posted_successfully?" doesnt work anymore.
Here is my Solution to the Issue:
You can read the URL after the user submited the form.
There is always something you can use to check for if the user submited the form.
For example i used the the get paramter "form_type=customer".
Everytime this get parameter is set on the URL i will also redirect the user from the landing page to my other "thank-you-page". (via. JavaScript)
Here is my Code:
{%- if form.posted_successfully? -%}
<script>window.location.href="/pages/thank-you";</script>
{%- elsif form.errors -%}
<!-- ERROR HANDLING -->
{%- else -%}
<script>
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
if(getUrlParameter('form_type')){
window.location.href="/pages/thank-you";
}
</script>
{% endif %}
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025