magento2: Uncaught ReferenceError: Unable to process binding "if: function(){return (addressOptions.length > 1) }" Message: addressOptions is not defined

Preconditions (*) Magento CE 2.3.2, PHP 7.1.30, Ubuntu 18.04, MariaDb 14.14, Magento caching enabled

Steps to reproduce install Magento 2.3.2 add any product to cart proceed to checkout enter login details click to Next check to Free Shipping and then click to next in the checkout payment page error occurs

Expected result (*) Checkout Payment successfully with no errors

Actual result (*) There is data-bind error - knockout.js:3391 Uncaught ReferenceError: Unable to process binding “if: function(){return (addressOptions.length > 1) }”

Message: addressOptions is not defined. Message: addressOptions is not defined at if (eval at createBindingsStringEvaluator (knockout.js:2992), <anonymous>:3:55) at ko.computed.disposeWhenNodeIsRemoved (knockout.js:4391) at Function.evaluateImmediate_CallReadThenEndDependencyDetection (knockout.js:2183) at Function.evaluateImmediate_CallReadWithDependencyDetection (knockout.js:2150) at Function.evaluateImmediate (knockout.js:2111) at Object.ko.computed.ko.dependentObservable (knockout.js:1964) at init (knockout.js:4390) at knockout.js:3368 at Object.ignore (knockout.js:1480) at knockout.js:3367

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 29 (3 by maintainers)

Most upvoted comments

It’s seems the problem is with template difference 2.3.1 with 2.3.2 If you rewrote the template vendor/magento/module-checkout/view/frontend/web/template/billing-address.html in your theme for magento 2.3.1, you can not see that this template is changed a lot in 2.3.2. In old version (2.3.1) the template Magento_Checkout/billing-address/list inserted directly in billing-address.html, but in 2.3.2 it is renders via “getRegion(‘billing-address-list’)” with ui component. So just make shure that billing-address.html in your theme is corresponded to billing-address.html in vendor

@celorodovalho I have fixed this issue by editing magento core file in vendor dir at vendor/magento/module-checkout/Block/Checkout/LayoutProcessor.php

You can see the change in my Git diff here: https://gist.github.com/hmphu/b752d3f1c401fd862bf5ee0552507322

Please try and share your result here if this work

Just delete: From: vendor/magento/module-checkout/Block/Checkout/LayoutProcessor.php Around Line 160

	if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-	step']['children']
	    ['payment']['children'])) {
	    $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']
	    ['payment']['children'] = $this->processPaymentChildrenComponents(
		$jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']
		['payment']['children'],
		$elements
	   );
	}

After upgrading to 2.3.3, I also had same issue:

knockout.js:3381 Uncaught ReferenceError: Unable to process binding "if: function(){return (addressOptions.length > 1) }"
Message: addressOptions is not defined
    at if (eval at createBindingsStringEvaluator (knockout.js:2982), <anonymous>:3:55)
    at ko.computed.disposeWhenNodeIsRemoved (knockout.js:4381)
    at Function.evaluateImmediate_CallReadThenEndDependencyDetection (knockout.js:2173)
    at Function.evaluateImmediate_CallReadWithDependencyDetection (knockout.js:2140)
    at Function.evaluateImmediate (knockout.js:2101)
    at Object.ko.computed.ko.dependentObservable (knockout.js:1954)
    at init (knockout.js:4380)
    at knockout.js:3358
    at Object.ignore (knockout.js:1470)
    at knockout.js:3357

Updating template: \app\design\frontend\THEME\PACKAGE\Magento_Checkout\web\template\billing-address.html from: \vendor\magento\module-checkout\view\frontend\web\template\billing-address.html worked for me.

@celorodovalho I have fixed this issue by editing magento core file in vendor dir at vendor/magento/module-checkout/Block/Checkout/LayoutProcessor.php

You can see the change in my Git diff here: https://gist.github.com/hmphu/b752d3f1c401fd862bf5ee0552507322

Please try and share your result here if this work

This fix really works!