How to fix «Unable to process binding "css: function (){return { empty:cart().summary_count == 0} }"» / «Message: cart is not a function»?

bug
javascript
bug-fix
knockout

(Dmitry Fedyuk) #1


How did I upgrade earosacoustic.com from Magento 2.0.2 to 2.2.2?
(Dmitry Fedyuk) #2

The issue is fixed in 2.2.0 and 2.1.9.

github.com/magento/magento2/issues/5946#issuecomment-336415013

How to fix it manually (in an earlier Magento version)

Step 1.

Replace the block:

With the following one:

Step 2.

Replace in app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html all occurences of cart().<property> to getCartParam('<property>').

Example 1.

From:

cart().summary_count

to:

getCartParam('summary_count')

Example 2.

From:

to:

Step 3.

Replace the block:

With the following one: