subscribe form /challenge#footer-newsletter redirect to another page

sirhcnus
Shopify Partner
6 0 1

Hi there 

How to redirect subscribe form /challenge#footer-newsletter once it submit go a thank you page

Thanks in advance!

 

Replies 3 (3)

sirhcnus
Shopify Partner
6 0 1

I found the answer redirect add this code in theme.liquid in the bottom just change the ID

 

<script>
      $(document).ready(function(){
        var $returnTo = $('<input type="hidden" name="return_to" value="/pages/thank-you"/>');

        if ($('#footer-newsletter').length > 0){ //if form
          $returnTo.insertBefore($('#footer-newsletter input[type="submit"]')); // add return_to input
        } else if ($('#newsletter-popup').length > 0){ //if form
          $returnTo.insertBefore($('#newsletter-popup input[type="submit"]')); // add return_to input
        } else if ($('#g-recaptcha').length){ //if captcha form
           $returnTo.insertBefore($('.shopify-challenge__container input[type="submit"]'));
        }
      });
	</script> 

 

jan201
Visitor
2 0 0

Hi, I'm new to this, would like to ask what ID is supposed to be changed in the code? 

NerdyEcomDude
Tourist
9 0 4

hey this is great, how does it work? Trying to do this on the Debut theme. What ID are we supposed to change? 

Thanks!