Java Script Error in CheckOut Page - unable to complete a checkout

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 3 ans
The Checkout process for the one page checkout is getting stuck on third step, the continue button after the ShippingMethod step is not responding.  then, I check on the Browser Inspect and noticed the JavaScript Error:

Uncaught TypeError: $(...).countrySelect is not a function
    at Object.initializeCountrySelect (public.onepagecheckout.js:188:69)
    at Object.nextStep [as success] (public.onepagecheckout.js:183:17)
    at c (jquery.min.js:2:28294)
    at Object.fireWith [as resolveWith] (jquery.min.js:2:29039)
    at l (jquery.min.js:2:79800)
    at XMLHttpRequest.<anonymous> (jquery.min.js:2:82254)


What can I do to move it forward and continue to the Payment Section?
Il y a 3 ans
do you have upgraded your project ? Jquery not loaded properly. some new tag introduced at nop4.50
Il y a 3 ans
Hi,  I added a Jquery source right above the area where JQuery code is getting called and it is still failing.  This is where it is failing.  I had to disable that call for it to continue.  Is that normal?

        //Billing.initializeCountrySelect();
    },
    
    initializeCountrySelect: function () {
        if ($('#opc-billing').has('select[data-trigger="country-select"]')) {
            $('#opc-billing select[data-trigger="country-select"]').countrySelect();
        }
    }
Il y a 3 ans
please check your solution is there multiple public.onepagecheckout.js file. may be inside plugin &  wwwroot/js
Il y a 3 ans
It look like that I have to comment-out the call to the countryselect function for it to continue.  When leave it on, then the error is generated.
Il y a 3 ans
there should this line at _Root.Head.cshtml
Html.AppendScriptParts(ResourceLocation.Footer, "~/js/public.countryselect.js");

initializeCountrySelect: function () {
    if ($('#opc-shipping').has('select[data-trigger="country-select"]')) {
     $('#opc-shipping select[data-trigger="country-select"]').countrySelect();
    }
  }
countrySelect() function is coming from there
Il y a 3 ans
Yes,  _root.head has this script on line 23:


Html.AppendScriptParts(ResourceLocation.Footer, "~/js/public.countryselect.js");


Then, since I am using the OnePage checkout page to navigate the checkout, it als has these entries:

Html.AddScriptParts(ResourceLocation.Footer, $"~/js/public.accordion.js);
Html.AddScriptParts(ResourceLocation.Footer, $"~/js/public.onepagecheckout.js");


The call to Country Select is coming from the public.onepagecheckout.js, which is causing the error.  When I comment-out the call from onpagecheckout.js, then the error does not happened and I can continue; otherwise, the page does not move or react to the Continue button from onepagecheckout.cshtml
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.