简体   繁体   中英

Magento-2 mini bag added product is not working in IE-11?

I am facing an issue with Internet Explorer. It is possible to add products to a mini bag on my page. You can take a look in the mini-bag in a popup, where the products are listed in a drop-down.

On Internet Explorer, the mini bag pop-up will not display newly added products, which were added after the page was loaded, eventhough they are added to the mini bag. If you then change the page the mini bag displays the (1) icon as normal and the product shows properly in the drop-down.

The technology I am using is Magento 2. When I click on the add to bag button the following error is shown in the console:

Object doesn't support property or method 'find'

options-updater.js (26.9)

This is the mentioned line:

changedProductOptions = data.items.find(function (item) {
    return item['product_id'] === productId;
});

Note: It is working fine with Edge browser.

Please help. I don't know why IE does not support js for mini bag adding product features.

After the ES-6 standards, the find() method is no longer working with IE browsers. For this, you can use the map() method,

Here is the code sample:

changedProductOptions = data.items.map(function (item) {
      return item['product_id'] === productId;
});

Hope this will work for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM