3

I ran into a issue where i could add products to cart and i got success message too but the minicart is not updating with the added items.

I got below error in console, I have upgraded the magento to 2.1.0

TypeError: cart is not a function in knockout.js

Did anyone came across this issue.

4

I have updated the bind events in the minicart file by comparing the base codes, once after update. It worked. Just compare the minicart.phtml file from theme

app\design\frontend\Theme_namespace\Theme_module\Magento_Ch‌​eckout\templates\car‌​t

with core template

vendor\magento\module-checkout\view\frontend\templates\cart‌

​In these two files class and bind events may be different in your theme, that is why it is not updating.

  • I have the same problem ... would you post some more details about what you have done? – Arnie Jul 26 '16 at 8:40
  • Just compare the minicart.phtml file from theme (app\design\frontend\Theme_namespace\Theme_module\Magento_Checkout\templates\cart) with core template (vendor\magento\module-checkout\view\frontend\templates\cart), class and bind events may be different in your theme, so only it is not Updating. – user2520 Jul 26 '16 at 9:15
1

The function cart() was replaced with getCartParam() in 2.1.5 version, so for example, cart().summary_count becomes getCartParam('summary_count')

1

If you're working with Porto theme or 3rd theme. You need one more step : replace content.html of porto theme with core content.html file to make it works.

Three steps which I solved this problem:

  1. Replace the minicart.phtml file from theme (app\design\frontend\Theme_namespace\Theme_module\Magento_Ch‌​eckout\templates\car‌​t) with core template (vendor\magento\module-checkout\view\frontend\templates\cart‌​).
  2. Replace content.html file from your theme (app\design\frontend\Theme_namespace\Theme_module\Magento_Checkout\web\template\minicart\content.html) with core template (vendor\magento\module-checkout\view\frontend\web\template\minicart\content.html)
  3. Remove all pub/static/frontend , remove var folder. Run deploy static content again : php magento setup:static-content:deploy

Result minicart after fixed

0

The function cart() was replaced with getCartParam(), so for example, cart().summary_count becomes getCartParam('summary_count'). You can download the files in this post http://iddema.com/porto-theme-cart-is-not-function/

Files http://iddema.com/wp-content/uploads/2018/01/Smartwave.zip

Your Answer

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