Magento 2.2.5, upgraded from 2.1.5. The mini cart in the header is not working properly. When you add something to the cart it says, 1 item available, that part is correct. However the subtotal and the items are not appearing
The following error is in the console:
knockout.js:3012 Uncaught TypeError: Unable to process binding "foreach: function(){return $parent.getRegion($parent.getItemRenderer(item.product_type)) }" Message: Cannot read property 'simple' of undefinedat UiClass.getItemRenderer (minicart.js:140)
which refers to these lines in minicart.js
getItemRenderer: function (productType) { return this.itemRenderer[productType] || 'defaultRenderer'; //return 'defaultRenderer'; },
Console log shows "simple" for productType
If I comment out the return line and just return "defaultRenderer" it gives no errors but just no items.
This was using a custom Theme, not made by me but even reverting to Default Blank theme still gives the same error.
"itemRenderer" is in vendor/magento/magento-checkout/view/frontend/layout/checkout_car_sidebar_item_renderers.xml and other similar questions seem to imply that there is an issue in the XML but I can't see anything wrong with it.
I have disabled all non Magento_ extensions and there was no difference.
I installed 2.2.5 locally and took the vendor/magento/magento-checkout files and put them in this site, just in case, and deleted the module-checkout files from the app/design theme folder and it's still giving the same error. I have deployed static files, cleared cache, reindexed etc etc. Is there anything else I could be trying?
You can follow below link it will help you to solve your problem:
https://magento.stackexchange.com/questions/100792/magento2-knockout-js-issue-on-cart
Hi Manish
I'm not sure I understand these posts. My current Magento_theme layout/default.xml file has this in it
<referenceContainer name="header.container">
<container name="header-wrapper" label="Page Header" as="header-wrapper" htmlTag="div" htmlClass="header content">
<block class="Magento\Theme\Block\Html\Header\Logo" name="logo" >
...
</block>
<container name="header.panel.right.wrapper" htmlClass="header-right" after="logo" htmlTag="div" >
<container name="header.panel.wrapper" htmlClass="panel wrapper" after="logo" htmlTag="div" >
<container name="header.panel" label="Page Header Panel" htmlTag="div" htmlClass="panel header">
<block class="Magento\Framework\View\Element\Template" name="skip_to_content" template="Magento_Theme::html/skip.phtml">
....
</block>
<block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="switch/languages.phtml"/>
<block class="Magento\Framework\View\Element\Html\Links" name="top.links">
...
</block>
</container>
</container>
<container name="header.panel.right.wrapper.bottom" htmlClass="header-right-bottom" htmlTag="div" >
<block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="header.panel.wrapper" template="cart/minicart.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="types" xsi:type="array"/>
<item name="components" xsi:type="array">
<item name="minicart_content" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/minicart</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/minicart/content</item>
</item>
<item name="children" xsi:type="array">
<item name="subtotal.container" xsi:type="array">
... subtotal stuff...
</item>
<item name="extra_info" xsi:type="array">
...
</item>
</item>
</item>
</item>
</argument>
</arguments>
<container name="minicart.addons" label="Mini-cart promotion block"/>
</block>
<block class="Magento\Framework\View\Element\Template" name="top.search" as="topSearch" template="Magento_Search::form.mini.phtml" />
</container>
</container>
</container>
</referenceContainer>Does this look incorrect? Thanks!
I can not find top-header in this, can you please check once

It appears to be working now - I'm not sure if it's the upgrade to 2.2.6 but it's working. Just don't want you wasting any time @Manish Mittal looking at it. I will report back with the cause and fix once I figure out what it was. In the meantime thank you!
@aisling_watters Thanks, Let me know if you will face any issue. Please close this issue if it is working ![]()