Magento2: Cannot read property 'autocomplete' of undefined

Created on 13 Feb 2017  路  11Comments  路  Source: magento/magento2


Preconditions


  1. Magento 2.1.4
  2. PHP 7.0.14
  3. MySQL 5.6.22
  4. Google Chrome 56.0.2924.87 (Official Build) (64-bit)

Steps to reproduce

  1. Add two products to the shopping cart
  2. Navigate to the shopping cart page at /checkout/cart/
  3. Click "Checkout with multiple addresses"
  4. Follow the steps

Expected result

  1. No javascript crashes
  2. No interference with Payment Methods

Actual result

  1. Javascript crash
  2. Payment Methods do not appear

screen shot 2017-02-13 at 15 28 33

Clear Description Format is valid Ready for Work bug report

All 11 comments

I have exact same errors on any page. Magento version 2.1.4 and earlier.

I am using magento version 2.1.6 and also getting the same error.

Hi, @snez. Thanks for reporting this issue. We've created internal ticket MAGETWO-70389 to address this issue.

For what it is worth, I think I have tracked this down as the route cause (a long with https://github.com/magento/magento2/issues/6983) for some issues around gift message fields in basket not loading as the jQuery has an error. This doesn't explain why other elements do work - but fixing this solved the issue after a considerable amount of time looking in to it.

I am also having this issue, does anyone know of a work around? Thanks.

@snez, thank you for your report.
The issue is already fixed in develop branch, 2.2.0

I started having 'autocomplete' of undefined exact same as @snez described when I was asked to by my team to remove shopping cart icon completely so I did in my custom theme I added:

<referenceBlock name="top.links">
     <referenceBlock name="minicart" remove="true" />
</referenceBlock> 

Didn't see the undefined until I had to look at the chrome console for debugs I got a surprise and spend a few hours trying to figure it out what was causing the issue then gotcha! now I am just using css to display:none .
ref: Magento 2.1.7

https://magento.stackexchange.com/questions/125034/js-errors-magento-2

This will work
Copy file from
vendor/magento/module-customer/view/frontend/web/js/view/authentication-popup.js
to
app/design/frontend///Magento_Customer/web/js/view/authentication-popup.js

and replace the below code
from
autocomplete: window.checkout.autocomplete
to
autocomplete: ((window.checkout && window.checkout.autocomplete) ? window.checkout.autocomplete : null),

Line No : 26

Please run bin/magento setup:static-content:deploy command.

Hope this will work for you

In addition to the update from @aimscoder, I had to include the following in the same file.

login: function (formUiElement, event) {
            var loginData = {},
                formElement = $(event.currentTarget),
                formDataArray = formElement.serializeArray();

becomes

login: function (formUiElement, event) {
            if(!event){
                event = window.event;
            }
            var loginData = {},
                formElement = $(event.currentTarget),
                formDataArray = formElement.serializeArray();
Was this page helpful?
0 / 5 - 0 ratings