The Summary in cart view before proceeding to checkout shows $0 shipping and an undefined variable.
This isn't as bad as saying "Free shipping!" and then once the user enters their address the shipping gets tacked on making the customer upset...
But it would be better to say "Shipping to be determined" or something along the lines of this before the address is given and shipping method is selected.
Anyone know how to fix this?
"undefined" is just a JavaScript language term.
Please check whether you have a JavaScript error in the browser's console: https://mage2.pro/t/278
If you do not have JavaScript errors then the "undefined" is just a result of an incorrect JavaScript operation which fails silently.
Not seeing any errors output to console. I understand the variable is undefined, So thats a problem, since the system shouldn't be trying to output shipping cost prior to getting the customers address and them selecting a method. So whys it adding it to the cart summary before hand? I need to block it from showing until the customer has chosen a shipping method.
Hi!
I've the JavaScript error:
Uncaught ReferenceError: Unable to process binding "if: function (){return displaySubtotal() }"
Message: Unable to process binding "if: function (){return !display_cart_subtotal_excl_tax && display_subtotal_incl_tax }"
Message: display_subtotal_incl_tax is not defined.
Any idea how to fix ?
If after entering address details your checkout looks somewhat like this:
... most likely the reason why the issue occurs is because your service doesn't provide the correct response to the estimate-shipping-methods query.
You can check what the server response in the browser console:
The inability of Magento 2 to process cases with invalid JSON in a server response makes the script put a high load on the browser (it just gets in a loop). Plus, the script creates a big amount of "s_method_undefined_undefined" methods ("undefined" means that when sending a query, no response was received, since the object is empty).
In most cases, the issue was caused by the absence of these php.ini settings:
date.timezone = America/New_York always_populate_raw_post_data = -1
Right after you add them, the checkout should start working as expected.
Most likely, a similar issue can occur because of other missing php settings -- they can trigger errors when executing the code.
Also, most likely, disabling error display (magento deploy:mode:set production) will let you avoid such behaviour at the checkout step.