cancel
Showing results for 
Search instead for 
Did you mean: 

Checkout Summary shows undefined - undefined shipping before selecting a shipping cariier

Checkout Summary shows undefined - undefined shipping before selecting a shipping cariier

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.

5 REPLIES 5

Re: Checkout Summary shows undefined - undefined shipping before selecting a shipping cariier

Anyone know how to fix this?

Re: Checkout Summary shows undefined - undefined shipping before selecting a shipping cariier

"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.

Re: Checkout Summary shows undefined - undefined shipping before selecting a shipping cariier

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.

Re: Checkout Summary shows undefined - undefined shipping before selecting a shipping cariier

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 ?

Re: Checkout Summary shows undefined - undefined shipping before selecting a shipping cariier

@OB7DEV

 

If after entering address details your checkout looks somewhat like this:

 

cddaa06836e162b21d81ae56ee6a35b3.png

 

... 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:

 

7638764542824a6959ac577fd2969cc7.png

 

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.

 

2eb89ecda718bdda995a6ee4c4874c2f.png

 

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.

 

______________________________________________________________
Innovative, top-performing Magento Extensions (with an array of FREE tools).