4

We have recently upgraded to Magento ver. 2.3.4 from 2.3.1 (open source) and currently have an issue in Checkout for registered customers. When they get to the shipping part of checkout they cannot see the buttons for selecting a different shipping address or editing an address:

enter image description here

Looking at the developer console we can also see an Uncaught error shich seems to relate to address:-

enter image description here

 Uncaught TypeError: Unable to process binding "foreach: function(){return {data:address().customAttributes,as:'element'} }"
 Message: Unable to process binding "text: function(){return $parent.getCustomAttributeLabel(element) }"
 Message: Cannot read property 'undefined' of undefined
     at UiClass.getCustomAttributeLabel (VM7680 default.js:68)
     at text (eval at createBindingsStringEvaluator (VM5344 knockout.js:1), <anonymous>:3:72)
     at update (VM5344 knockout.js:4659)
     at ko.dependentObservable.disposeWhenNodeIsRemoved (VM5344 knockout.js:3373)
     at Function.evaluateImmediate_CallReadThenEndDependencyDetection (VM5344 knockout.js:2173)
     at Function.evaluateImmediate_CallReadWithDependencyDetection (VM5344 knockout.js:2140)
     at Function.evaluateImmediate (VM5344 knockout.js:2101)
     at Object.ko.computed.ko.dependentObservable (VM5344 knockout.js:1954)
     at VM5344 knockout.js:3371
     at Object.arrayForEach (VM5344 knockout.js:159)

In addition we also get a similar error on the billing page

 Uncaught TypeError: Unable to process binding "if: function(){return isAddressDetailsVisible() && currentBillingAddress() }"
 Message: Unable to process binding "foreach: function(){return {data:currentBillingAddress().customAttributes,as:'element'} }"
 Message: Unable to process binding "text: function(){return  $parent.getCustomAttributeLabel(element) }"
 Message: Cannot read  property 'undefined' of undefined
     at UiClass.getCustomAttributeLabel (billing-address.js:258)
     at text (eval at createBindingsStringEvaluator (knockout.js:2982), <anonymous>:3:72)
     at update (knockout.js:4659)
     at ko.dependentObservable.disposeWhenNodeIsRemoved (knockout.js:3373)
     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 knockout.js:3371
     at Object.arrayForEach (knockout.js:159)

The customer data in the window.checkoutConfig is as follows

customerData:
website_id: "1"
email: "customeremail"
group_id: "1"
store_id: "1"
created_at: "2018-07-05 08:18:08"
updated_at: "2020-02-24 11:55:12"
disable_auto_group_change: "0"
created_in: "English"
prefix: null
firstname: "test"
middlename: null
lastname: "test"
suffix: null
dob: null
default_billing: "17058"
default_shipping: "17058"
taxvat: null
confirmation: null
gender: null
custom_attributes:
rewards_subscription:
attribute_code: "rewards_subscription"
value: "1"
__proto__: Object
mst_rewards_tier_id:
attribute_code: "mst_rewards_tier_id"
value: "1"
__proto__:
constructor: ƒ Object()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
hasOwnProperty: ƒ hasOwnProperty()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toString: ƒ toString()
valueOf: ƒ valueOf()
toLocaleString: ƒ toLocaleString()
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()
__proto__:
constructor: ƒ Object()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
hasOwnProperty: ƒ hasOwnProperty()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toString: ƒ toString()
valueOf: ƒ valueOf()
toLocaleString: ƒ toLocaleString()
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()
addresses:
17058:
id: "17058"
customer_id: "16774"
company: "Company Name"
prefix: null
firstname: "Test"
lastname: "Test"
middlename: null
suffix: null
street: (2) ["Unit X, Street Name One,", "Street Name Two,"]
city: "Cityname"
region: {region: null, region_code: null, region_id: 0}
region_id: "0"
postcode: "AB12 3CD"
country_id: "GB"
telephone: "1234567890"
fax: null
default_billing: true
default_shipping: true
inline: "Test Test, Unit X, Street Name One, Street Name Two,, Cityname,  AB12 3CD, United Kingdom"
custom_attributes: Array(0)
length: 0
__proto__: Array(0)
length: 0
constructor: ƒ Array()
concat: ƒ concat()
copyWithin: ƒ copyWithin()
fill: ƒ fill()
find: ƒ find()
findIndex: ƒ findIndex()
lastIndexOf: ƒ lastIndexOf()
pop: ƒ pop()
push: ƒ push()
reverse: ƒ reverse()
shift: ƒ shift()
unshift: ƒ unshift()
slice: ƒ slice()
sort: ƒ sort()
splice: ƒ splice()
includes: ƒ includes()
indexOf: ƒ indexOf()
join: ƒ join()
keys: ƒ keys()
entries: ƒ entries()
values: ƒ values()
forEach: ƒ forEach()
filter: ƒ filter()
flat: ƒ flat()
flatMap: ƒ flatMap()
map: ƒ map()
every: ƒ every()
some: ƒ some()
reduce: ƒ reduce()
reduceRight: ƒ reduceRight()
toLocaleString: ƒ toLocaleString()
toString: ƒ toString()
Symbol(Symbol.iterator): ƒ values()
Symbol(Symbol.unscopables): {copyWithin: true, entries: true, fill: true, find: true, findIndex: true, …}
__proto__: Object
extension_attributes:
__proto__: Object
vat_id: null
__proto__:
constructor: ƒ Object()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
hasOwnProperty: ƒ hasOwnProperty()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toString: ƒ toString()
valueOf: ƒ valueOf()
toLocaleString: ƒ toLocaleString()
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()
21917:
id: "21917"
customer_id: "16774"
company: "Company Name"
prefix: null
firstname: "Test"
lastname: "Test"
middlename: null
suffix: null
street: ["Unit X, Street Name One, Street Name Two"]
city: "Cityname"
region: {region: "Countyname", region_code: "Countyname", region_id: 0}
region_id: "0"
postcode: "AB12 3CD"
country_id: "TW"
telephone: ""
fax: null
default_billing: null
default_shipping: null
inline: "Test Test, Unit X, Street Name One, Street Name Two,, Cityname,  AB12 3CD, Taiwan"
custom_attributes: {email: {…}}
extension_attributes: {}
vat_id: null
__proto__: Object
__proto__:
constructor: ƒ Object()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
hasOwnProperty: ƒ hasOwnProperty()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toString: ƒ toString()
valueOf: ƒ valueOf()
toLocaleString: ƒ toLocaleString()
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()
id: "16774"
extension_attributes:
is_subscribed: false
__proto__:
constructor: ƒ Object()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
hasOwnProperty: ƒ hasOwnProperty()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toString: ƒ toString()
valueOf: ƒ valueOf()
toLocaleString: ƒ toLocaleString()
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()
__proto__:
constructor: ƒ Object()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
hasOwnProperty: ƒ hasOwnProperty()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toString: ƒ toString()
valueOf: ƒ valueOf()
toLocaleString: ƒ toLocaleString()
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()

Could anyone please let me know why this is happening and what I need to to do resolve the issue please?

Edit 02 March 2020

Many thanks to Khoa TruongDinh. I've created a workaround solution which involves creating a new template in the following location:

httpdocs > app > design > frontend > ThemeVendor > ThemeName > Magento_Checkout > web > template > shipping-information > address-renderer > default.html

and commenting out the custom attributes section of the template

<if args="visible()">
    <text args="address().prefix"/> <text args="address().firstname"/> <text args="address().middlename"/>
    <text args="address().lastname"/> <text args="address().suffix"/><br/>
    <text args="_.values(address().street).join(', ')"/><br/>
    <text args="address().city "/>, <span text="address().region"></span> <text args="address().postcode"/><br/>
    <text args="getCountryName(address().countryId)"/><br/>
    <a if="address().telephone" attr="'href': 'tel:' + address().telephone" text="address().telephone"></a><br/>
<!-- 
    <each args="data: address().customAttributes, as: 'element'">
        <text args="$parent.getCustomAttributeLabel(element)"/>
        <br/>
    </each>
-->
</if>

Obviously this isn't ideal but at least it makes the website workable while I look for a better solution.

Edit 17 March 2020 - SOLUTION

With thanks to Simon this now seems to be resolved. I used trial and error on my development site.

Going into the database table eav_attribute and removing the following two values seems to have fixed the error:

ID - 175 -  validation_status 
ID - 257  - email

I'm not sure what validation status is and email seems to be a duplicate value. Regardless removing these two rows from the database table seems to have resolved the error.

I have now implemented this on our live site.

  • 1
    At first I would downgrade to the stable version again so that your customers can shop again. Then I would create a staging environment and upgrade it so that you can calmly analyse the problem. – Black Feb 28 at 15:13
  • Thank you. Unfortunately this is not possible as the reason we upgraded in the first place was to solve a few other issues which were worse than this one. We have a staging environment which I am currently trying to populate with a copy of this site so that I can begin testing without fear of breaking the main site.. – CJNotts Feb 28 at 15:38
  • You can enable template hints and then check in which template the button is rendered. Then analyse this template or replace your override with the original template. You need to overthink your workflow. Next time work with git and only make changes in staging and then if it works push the changes to master. – Black Feb 28 at 15:46
  • 1
    do you have any custom modules affects to the checkout customer addresses/ payments/ ? do you use open source or commerce edition? from which Magento version do you migrate from? – MageSoftech Feb 29 at 14:54
  • 1
    Thanks, this modules could not affect to this address until they have changed the checkout.config of site. Could you pls post website's window.checkout.config= it will be more data but just post customerData there will be custom_attributes section by view-source after loggedin. It looks like custom_attributes of customer not migrated properly. – MageSoftech Mar 1 at 10:30
2

I had exactly the same issue. I set a JS breakpoint in the line, which threw the error and looked at the attributes variable. There were multiple old attributes, which were migrated from M1. They lead to these issues. I simply deleted those old attributes in the database (table eav_attribute) and the error was gone.

| improve this answer | |
  • Thanks for this. My JS skills are not strong but I was able to use trial and error on the dev site. Removing the following two values seems to have fixed the error: 175 validation_status 257 email Email seems to be a duplicate value. – CJNotts Mar 17 at 10:56
4
+150

For this kind of issue, it's really hard to find the root cause. Magento is hard, Js is hard.

My suggestion is to use Debugger.

Get our hands dirty: based on your first error. I will find address().customAttributes in html template.

enter image description here

I can see 3 html templates - Magento default:

vendor/magento/module-checkout/view/frontend/web/template/billing-address/details.html

vendor/magento/module-checkout/view/frontend/web/template/shipping-address/address-renderer/default.html

vendor/magento/module-checkout/view/frontend/web/template/shipping-information/address-renderer/default.html

In this case, we can put the debugger code in 3 templates:

<div data-bind="text: ko.computed(function() { debugger; })"></div>

When debugger is trigger. In Console tab, we can check the address() object.

enter image description here

| improve this answer | |
  • Thank you. I’ll give that a try and let you know how it goes. – CJNotts Mar 1 at 9:58
  • You will get the benefits from this try. I'm sure about that. – Khoa TruongDinh Mar 1 at 10:29
  • Thanks for the tips. I've updated the question with the workaround solution I've implemented so far. – CJNotts Mar 2 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.