WooCommerce custom checkout verification not workingHow do JavaScript closures work?How does JavaScript .prototype work?Submitting a form on 'Enter' with jQuery?How does the “this” keyword work?Run javascript function when user finishes typing instead of on key up?How does data binding work in AngularJS?How to add an icon to the WooCommerce “Proceed to Checkout” & “Update Cart” buttons located on the cart page?Customizing COD of WooCommerce on Checkout pageChange some checkout fields type using jQuery for a specific state in WoocommerceWooCommerce: Checkout expiration not working

Has the Hulk always been able to talk?

ZSPL language, anyone heard of it?

Why aren't nationalizations in Russia described as socialist?

What are the differences between credential stuffing and password spraying?

Something that can be activated/enabled

Adjacent DEM color matching in QGIS

Should I decline this job offer that requires relocating to an area with high cost of living?

Pressure inside an infinite ocean?

Where are the "shires" in the UK?

"I'm know" is correct?

Emotional immaturity of comic-book version of superhero Shazam

Shutter speed -vs- effective image stabilisation

How long would it take for people to notice a mass disappearance?

How can I support myself financially as a 17 year old with a loan?

Chapter style minimal design

Should homeowners insurance cover the cost of the home?

Why did the Apollo 13 crew extend the LM landing gear?

Find the cheapest shipping option based on item weight

Why do people keep telling me that I am a bad photographer?

How can I get a job without pushing my family's income into a higher tax bracket?

Are there any of the Children of the Forest left, or are they extinct?

Is there an idiom that support the idea that "inflation is bad"?

Copy previous line to current line from text file

Can my company stop me from working overtime?



WooCommerce custom checkout verification not working


How do JavaScript closures work?How does JavaScript .prototype work?Submitting a form on 'Enter' with jQuery?How does the “this” keyword work?Run javascript function when user finishes typing instead of on key up?How does data binding work in AngularJS?How to add an icon to the WooCommerce “Proceed to Checkout” & “Update Cart” buttons located on the cart page?Customizing COD of WooCommerce on Checkout pageChange some checkout fields type using jQuery for a specific state in WoocommerceWooCommerce: Checkout expiration not working






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I'm currently trying to make a second (first) checkout verification. For this job I need to prevent the standard WooCommerce checkout verification. I've did this with a lot of forms before but this time the trigger don't responds.



What I expect:



When the user clicks the Place Order button, the standard WooCommerce checkout verification should not run and the browser alerts my text.



What happens:



When I click the button, I don't see any text/alert.



My code:



jQuery(document).ready(function () 

var checkoutForm = document.querySelector('.woocommerce-checkout');
var postcode = jQuery('#billing_postcode', checkoutForm);

if (checkoutForm != null)
checkoutFormValidation(checkoutForm, postcode);

);

function checkoutFormValidation(checkoutForm, postcode)

var checkoutButton = checkoutForm.querySelector('button[type="submit"]');

checkoutButton.addEventListener('click', function (e)

e.preventDefault();
alert("Clicked!");
);



I've checked everything and the file is included at the checkout. So no idea why this don't works.










share|improve this question




























    1















    I'm currently trying to make a second (first) checkout verification. For this job I need to prevent the standard WooCommerce checkout verification. I've did this with a lot of forms before but this time the trigger don't responds.



    What I expect:



    When the user clicks the Place Order button, the standard WooCommerce checkout verification should not run and the browser alerts my text.



    What happens:



    When I click the button, I don't see any text/alert.



    My code:



    jQuery(document).ready(function () 

    var checkoutForm = document.querySelector('.woocommerce-checkout');
    var postcode = jQuery('#billing_postcode', checkoutForm);

    if (checkoutForm != null)
    checkoutFormValidation(checkoutForm, postcode);

    );

    function checkoutFormValidation(checkoutForm, postcode)

    var checkoutButton = checkoutForm.querySelector('button[type="submit"]');

    checkoutButton.addEventListener('click', function (e)

    e.preventDefault();
    alert("Clicked!");
    );



    I've checked everything and the file is included at the checkout. So no idea why this don't works.










    share|improve this question
























      1












      1








      1








      I'm currently trying to make a second (first) checkout verification. For this job I need to prevent the standard WooCommerce checkout verification. I've did this with a lot of forms before but this time the trigger don't responds.



      What I expect:



      When the user clicks the Place Order button, the standard WooCommerce checkout verification should not run and the browser alerts my text.



      What happens:



      When I click the button, I don't see any text/alert.



      My code:



      jQuery(document).ready(function () 

      var checkoutForm = document.querySelector('.woocommerce-checkout');
      var postcode = jQuery('#billing_postcode', checkoutForm);

      if (checkoutForm != null)
      checkoutFormValidation(checkoutForm, postcode);

      );

      function checkoutFormValidation(checkoutForm, postcode)

      var checkoutButton = checkoutForm.querySelector('button[type="submit"]');

      checkoutButton.addEventListener('click', function (e)

      e.preventDefault();
      alert("Clicked!");
      );



      I've checked everything and the file is included at the checkout. So no idea why this don't works.










      share|improve this question














      I'm currently trying to make a second (first) checkout verification. For this job I need to prevent the standard WooCommerce checkout verification. I've did this with a lot of forms before but this time the trigger don't responds.



      What I expect:



      When the user clicks the Place Order button, the standard WooCommerce checkout verification should not run and the browser alerts my text.



      What happens:



      When I click the button, I don't see any text/alert.



      My code:



      jQuery(document).ready(function () 

      var checkoutForm = document.querySelector('.woocommerce-checkout');
      var postcode = jQuery('#billing_postcode', checkoutForm);

      if (checkoutForm != null)
      checkoutFormValidation(checkoutForm, postcode);

      );

      function checkoutFormValidation(checkoutForm, postcode)

      var checkoutButton = checkoutForm.querySelector('button[type="submit"]');

      checkoutButton.addEventListener('click', function (e)

      e.preventDefault();
      alert("Clicked!");
      );



      I've checked everything and the file is included at the checkout. So no idea why this don't works.







      javascript jquery wordpress woocommerce






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 at 23:14









      Mr. JoMr. Jo

      955320




      955320






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I've found the solution. The problem is, that there is another validation function which gets triggered by default. So if you want to just add a custom validation without loosing the WooCommerce validation, you can't do it the way I've tried. So the solution is to use the WooCommerce validation function:



          jQuery(document.body).on("checkout_error", function () 
          alert("Clicked!");
          );





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55308949%2fwoocommerce-custom-checkout-verification-not-working%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I've found the solution. The problem is, that there is another validation function which gets triggered by default. So if you want to just add a custom validation without loosing the WooCommerce validation, you can't do it the way I've tried. So the solution is to use the WooCommerce validation function:



            jQuery(document.body).on("checkout_error", function () 
            alert("Clicked!");
            );





            share|improve this answer



























              0














              I've found the solution. The problem is, that there is another validation function which gets triggered by default. So if you want to just add a custom validation without loosing the WooCommerce validation, you can't do it the way I've tried. So the solution is to use the WooCommerce validation function:



              jQuery(document.body).on("checkout_error", function () 
              alert("Clicked!");
              );





              share|improve this answer

























                0












                0








                0







                I've found the solution. The problem is, that there is another validation function which gets triggered by default. So if you want to just add a custom validation without loosing the WooCommerce validation, you can't do it the way I've tried. So the solution is to use the WooCommerce validation function:



                jQuery(document.body).on("checkout_error", function () 
                alert("Clicked!");
                );





                share|improve this answer













                I've found the solution. The problem is, that there is another validation function which gets triggered by default. So if you want to just add a custom validation without loosing the WooCommerce validation, you can't do it the way I've tried. So the solution is to use the WooCommerce validation function:



                jQuery(document.body).on("checkout_error", function () 
                alert("Clicked!");
                );






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 at 17:41









                Mr. JoMr. Jo

                955320




                955320





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55308949%2fwoocommerce-custom-checkout-verification-not-working%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

                    밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

                    1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴