Untitled

 avatar
unknown
plain_text
a year ago
1.4 kB
8
Indexable
<script>
  (function(w,d) {
    function insertBefore(el, referenceNode) { referenceNode.parentNode.insertBefore(el, referenceNode); }
    if(window.location.pathname.indexOf("/challenge") != -1 && window.location.href.indexOf("#contact_form") == -1) {
      var find = function() {
        if(document.getElementById("g-recaptcha")) {
            var redirect = document.createElement('input');
            redirect.type = "hidden";
            redirect.name = "return_to";
            redirect.value = "/cart";
            insertBefore(redirect, document.querySelector('.shopify-challenge__container input[type="submit"]'));
        }
        else
            setTimeout(find, 1000);
      };
      setTimeout(find, 1000);
    } else {
      var find = function() {
          let registerField = document.getElementById("create_customer") || document.getElementById("RegisterForm") || document.getElementById("register-customer");
          if(registerField) {
              var redirect = document.createElement('input');
              redirect.type = "hidden";
              redirect.name = "return_to";
              redirect.value = "/cart";
              registerField.append(redirect);
          }
          else
              setTimeout(find, 1000);
      }
      setTimeout(find, 1000);
    }
  })(window, document);   
</script>
Editor is loading...
Leave a Comment