Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magento2 Mini Cart Items Issue #4170

Closed
wclansar opened this issue Apr 15, 2016 · 70 comments

Comments

Projects
None yet
@wclansar
Copy link

commented Apr 15, 2016

Hello ,

  1. After login , i can not see items in minicart .
  2. when i click on add to cart from home page widget products , mini cart not displaying add items .

Can you please help ?

Thanks

@wclansar wclansar changed the title Magento Mini Cart Items Issue Magento2 Mini Cart Items Issue Apr 15, 2016

@ishakhsuvarov ishakhsuvarov self-assigned this Apr 15, 2016

@ishakhsuvarov ishakhsuvarov added the CS label Apr 15, 2016

@ishakhsuvarov

This comment has been minimized.

Copy link
Contributor

commented Apr 15, 2016

@wclansar Thank you for reporting. Could you please provide more precise steps to reproduce? Which Magento version are you using? Any errors in browser console?

@ansarhusain

This comment has been minimized.

Copy link

commented Apr 15, 2016

Hello i am using magento 2.0.4

There is not error in console.

@sdzhepa

This comment has been minimized.

Copy link
Contributor

commented Apr 15, 2016

Hello @wclansar and @ansarhusain, we tried to reproduce this issue by next case:

  • Clone magento from GitHub: git clone https://github.com/magento/magento2.git (this is "develop" branch)
  • Then switch branch to 2.0: git checkout -f 2.0
  • Install Magento 2 (with default values during web installation, sample data is not used)
  • After installation, login to admin
  • Go to Products > Catalog and click "Add Product"
  • Then fill all required fields for creating simple product:
  • Name = simple product
  • SKU = simple product
  • Price = 10
  • Tax Class = Taxable Goods
  • Quantity = 1
  • Categories = test (click "New Category" and create category "test" as child for "Default Category")
  • Save the product(all other settings in default state)
  • Go to Storefront as Guest (the same result if we use registered customer)
  • Click for open "test" category
  • Click "Add to Cart" button

Result:

  • Product is added to cart
  • Mini cart has 1 product(simple product)
  • Red Icon with number 1 is presented near mini cart

Could you pls provide more information about Your Magento 2 and server settings, like

  • Which version of PHP do you use, php 7.0.4?
  • Do You use Varnish or not?
  • Do You use Redis or not?
  • Do You use HTTPS or HTTP for Storefront and admin?
  • Do You use Sample Data?
  • Which Magento 2 mode do You use? (default/develop/production)
  • Do You use Definition compilation Tool after installation?
  • Do You use Static Content Deploy after installation?
  • Do You use JS minification ?
  • Do You use JS Bundling?
  • Do You use JS merge?
  • Do You use HTML minification?
  • Do You use Flat Catalog Product?
  • Do You use CDN as Static Content?
  • Wich browser do You use? (Firefox/Chrome/IE)
    Probably there is other specific configuration that we miss.
@longbeachjamie

This comment has been minimized.

Copy link

commented Apr 26, 2016

Having the same issues here - https://utilitnetworks.com/ - item added to cart, but the mini-cart is not displaying any contents.

  • PHP Version 5.6.20-1+deb.sury.org~trusty+1
  • No Varnish, Redis
  • HTTPS only
  • No Sample Data
  • Current application mode is default
  • No javascript bundling, merge, or minify.
  • No CSS merge or minify.
  • No HTML minify.
  • Enabled Single Store Mode.
  • No CDN
  • Chrome browser.
@piotrekkaminski

This comment has been minimized.

Copy link
Contributor

commented May 24, 2016

Anyone else having this issue? we are unable to replicate. Do you see any errors in the browser console or any failed AJAX requests?

@krlecarp

This comment has been minimized.

Copy link

commented May 24, 2016

Yes. On 2.1.0-RC1, not sure what it was like on 2.0.6 as I upgraded right away. Chrome console says the following, along with the screen capture. Hopefully that is sorta helpful.

knockout.js:3012 Uncaught ReferenceError: Unable to process binding "foreach: function (){return { data:cookieMessages,as:'message'} }"
Message: cookieMessages is not defined
knockout.js:3012 Uncaught ReferenceError: Unable to process binding "css: function (){return { empty:!!getCartParam('summary_count') == false} }"
Message: getCartParam is not defined

image

@piotrekkaminski

This comment has been minimized.

Copy link
Contributor

commented May 24, 2016

Internal issue MAGETWO-53432

@BeniSt

This comment has been minimized.

Copy link

commented May 29, 2016

I have the same issue:

Magento 2.0.7
PHP Version 7.0.4.
No Varnish, Redis
HTTPS only
No Sample Data
Current application mode is default
No javascript bundling, merge, or minify.
No CSS merge or minify.
No HTML minify.
Enabled Single Store Mode.
No CDN
Chrome browser.

@tkacheva

This comment has been minimized.

Copy link

commented May 31, 2016

Thanks for reporting issue. Internal ticket MAGETWO-53766

@SerhiyShkolyarenko

This comment has been minimized.

Copy link
Contributor

commented Jun 1, 2016

@longbeachjamie, I tried it on your store and minicart worked properly.
As admin you may recheck my cart(created user with my real first and last name).

@grasdaggel

This comment has been minimized.

Copy link

commented Jun 1, 2016

Can confirm that this bug happens in 2.0.7. as well. We have a Magento installation where we had huge problems after update yesterday. Since then the mini cart only shows the amount of products (if it does it anyway...). MIni cart is empty, even with 20 Items in Cart.

Maybe a Update-Bug?

@SerhiyShkolyarenko

This comment has been minimized.

Copy link
Contributor

commented Jun 1, 2016

@kingalca, yes, it may be.
Which release you updated from?

@grasdaggel

This comment has been minimized.

Copy link

commented Jun 1, 2016

@SerhiyShkolyarenko we updated from 2.0.4. iirc. (So .0.4 => .0.7)

@thills03

This comment has been minimized.

Copy link

commented Jun 1, 2016

Just an observation, as I am having this same issue.

Landing on /checkout/cart after adding a product from a page that doesn't use the product widget to add it, then navigating back to the home page and trying to add a product using the product widget fixes the bug until the cookies are cleared. I suspect there is some JavaScript that isn't running correctly on the home page regarding the cookie generation.

As a side note, landing on checkout/cart with no products in the cart, will not fix the bug, a product must be added from a page with (for example a category page (layout: catalog_category_view.xml)) before landing on checkout/cart.

Hopefully this information is helpful.

@BeniSt

This comment has been minimized.

Copy link

commented Jun 1, 2016

I can confirm this @thills03!
I Click on add-to-cart Button on Home-Site in Widget and minicart and even the red Counter stay empty. If i go to cart page, Item is added. Only if I add an item the normal way (on product or category Page) the item appears in minicart.

@wclansar

This comment has been minimized.

Copy link
Author

commented Jun 2, 2016

Hello BeniSt ,

can you check is your cache disable ?

Because it seems that issue comes when cache off .

Thanks

@grasdaggel

This comment has been minimized.

Copy link

commented Jun 2, 2016

We have cache on and the issue, so disabled caching can't really be the issuer here.

@BeniSt

This comment has been minimized.

Copy link

commented Jun 2, 2016

Yes, in my case you are right. If I enable cache, the minicart works as it should. Cool. Thanks!

@wclansar

This comment has been minimized.

Copy link
Author

commented Jun 2, 2016

Welcome Brother BeniSt !!!!!!!!

@SerhiyShkolyarenko

This comment has been minimized.

Copy link
Contributor

commented Jun 2, 2016

@thills03 what do you mean by words "adding a product from a page that doesn't use the product widget to add it" ?

@thills03

This comment has been minimized.

Copy link

commented Jun 2, 2016

I mean that if you add a product to your cart from a page with a built in product list and not a product widget added in the cms through content->pages to your home page then you navigate to yoursite/checkout/cart and then navigate back to where you do have a product widget added through content->pages to your homepage and start adding more products, the cart will work fine. Until you clear your cookies.

@SerhiyShkolyarenko

This comment has been minimized.

Copy link
Contributor

commented Jun 2, 2016

@BeniSt @wclansar @kingalca @thills03 I cannot reproduce the issue.

Part 1. Pure 2.0.4 installation with caching enabled.

  1. I set up 2.0.4 CE without sample data from https://www.magentocommerce.com/download release archives.
  2. Installed Magento in default mode.
  3. Created product on backend.
  4. Added product to cart as guest from category page.

Minicart worked properly.

Part 2. The same 2.0.4 with disabled cache.

  1. Flushed Magento cache.
  2. Disabled all cache types on backend.
  3. Cleared browser lolalStorage from console: window.localStorage.clear()
  4. Cleaned all cookies for the store.
  5. Refreshed frontend category page by Ctrl-F5.
  6. Added product to cart.

Minicart worked properly, but much slower(because of disabled cache)

Part 3. Upgrage to 2.0.7(enabled cache).

  1. I backed up files app/etc/env.php and app/etc/config.php
  2. Downloaded Magento 2.0.7 CE without sample data from https://www.magentocommerce.com/download
  3. Removed folder with old Magento
  4. Unpacked new archive to the same folder.
  5. Restored files config.php and env.php
  6. Ran bin/magento setup:upgrade
  7. Cleaned var/ directory
  8. Enabled cache on backend.
  9. Added product to cart as guest from category page.

Minicart worked properly.

Part 4. CE 2.0.7 with disabled cache.

  1. Flushed Magento cache.
  2. Disabled all cache types on backend.
  3. Cleared browser lolalStorage from console: window.localStorage.clear()
  4. Cleaned all cookies for the store.
  5. Refreshed frontend category page by Ctrl-F5.
  6. Added product to cart.

Minicart worked properly, but much slower(because of disabled cache)

What am I doing wrong? Do you have any extensions installed? Please, hint me on reproducing the issue.

@filipac

This comment has been minimized.

Copy link

commented Sep 2, 2016

is there a known fix for this?

@mombrea

This comment has been minimized.

Copy link

commented Sep 4, 2016

If you have the problem where the minicart shows a blank white box, the solution is as @karmalis mentions. You should perform a diff on your overidden minicart.phtml template and the base version you're inheriting from (e.g. Magento/blank). Magento version updates are routinely changing functions in these files without warning.

As far as the minicart not showing products you just added (always empty), we have not found the cause of this problem but as others have mentioned, enabling the Block, Page, and Layout cache seems to fix it for whatever reason.

@kanduvisla

This comment has been minimized.

Copy link
Contributor

commented Sep 6, 2016

I have not overridden the minicart.phtml-template and still I have the problem:

  • If I add a product to the cart, the page refreshes rather than it's done with a XHR request.
  • After the page is reloaded, the minicart is not updated.
  • If I go to checkout/cart I see my added product(s).
  • If I mutate my cart here (click 'update cart', or edit qty or remove items) the minicart gets shown (after the page is reloaded of course).
  • From here on, it works. So if I empty my cart, and go to the product page, I see a minicart with '0'.
  • Now if I add a product, the minicart gets updated. However, still with no XHR request.
  • There are no JavaScript errors in the console.

Edit: If I enable the cache, above problem does not occur. Strange. Tested in M2.1.1

@mombrea

This comment has been minimized.

Copy link

commented Sep 6, 2016

Do you have all of the caches enabled or all of them disabled? I had this
problem when I had a mix of enabled/disabled.

On Sep 6, 2016 2:59 AM, "Giel Berkers" notifications@github.com wrote:

I have not overridden the minicart.phtml-template and still I have the
problem:

  • If I add a product to the cart, the page refreshes rather than it's
    done with a XHR request.
  • After the page is reloaded, the minicart is not updated.
  • If I go to checkout/cart I see my added product(s).
  • If I mutate my cart here (click 'update cart', or edit qty or remove
    items) the minicart gets shown (after the page is reloaded of course).
  • From here on, it works. So if I empty my cart, and go to the product
    page, I see a minicart with '0'.
  • Now if I add a product, the minicart gets updated. However, still
    with no XHR request.
  • There are no JavaScript errors in the console.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#4170 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA33ZIhFXvdIzoip881JRSgeEPGcjPLqks5qnQ9YgaJpZM4IIOJ5
.

@kanduvisla

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2016

When all the cached are enabled the problem does not occur.

@bvboas

This comment has been minimized.

Copy link

commented Sep 12, 2016

The commit for the fix is here: 861f596

@RishabhRkRai

This comment has been minimized.

Copy link

commented Oct 17, 2016

If cache is disabled then this issue is happen in 2.1.x

  • Kindly enable cache from terminal or backend and then try. This works for me.
@wojciechowskid

This comment has been minimized.

Copy link

commented Oct 19, 2016

If cache is disabled then this issue is happen in 2.1.x

The same for 2.0.10

@pyyick

This comment has been minimized.

Copy link

commented Oct 26, 2016

@wojciechowskid I disabled the cache, but the same error happens too.

@SantoDE

This comment has been minimized.

Copy link

commented Oct 26, 2016

I'm encountering the same Issue with a disabled FPC as well. While manually applying the fix commit above all works out. Is there any ETA on when this is getting into a "real version"? How do you guys apply those workarounds? I mean it's fixed in this git repro code. I don't really get that.

@DRAJI

This comment has been minimized.

Copy link

commented Jan 17, 2017

Enable caching is working for me. Thanks @wclansar

@dambrogia

This comment has been minimized.

Copy link

commented Jan 20, 2017

I have found this to help me. I was having a similar problem from multiple situations (customer login/logout, reordering functionality, etc.) and this seemed to fix them all. I found this online and from what I understand (and please correct me if I'm wrong) it's invalidating the minicart to force revalidation of the minicart via ko.

I added this in my .phtml file right after the html of my minicart has ended.

<script>
    require([
        'Magento_Customer/js/customer-data'
    ], function (customerData) {
        var sections = ['cart'];
        customerData.invalidate(sections);
    });
</script>
@rafaelstz

This comment has been minimized.

Copy link
Member

commented Feb 13, 2017

This issue was fixed to me when I upgrade my PHP version from 7.0.9 to 7.0.15.

@rajesh0608

This comment has been minimized.

Copy link

commented Feb 24, 2017

Yes, I enable cache, the minicart works as it should.

Thanks...

@FloWord

This comment has been minimized.

Copy link

commented Mar 17, 2017

My Solution for refresh Problem:
#5377

You simply need to change
"bindSubmit": false
to
"bindSubmit": true

@malachy-mcconnell

This comment has been minimized.

Copy link

commented Apr 26, 2017

Possibly related to #5946

Regarding comments about turning on the cache fixing the problem or adding the invalidation customerData.invalidate(sections);, I wonder if my suggestion of Mar 22 2017 on #5946 would solve and/or help in those circumstances.

@winds1983

This comment has been minimized.

Copy link

commented Apr 27, 2017

Still happens on 2.1.6, how to fix this?

@Tonop

This comment has been minimized.

Copy link

commented Apr 28, 2017

I see it in 2.1.6 too.

@dharake

This comment has been minimized.

Copy link

commented May 23, 2017

Joining in here, tried all the fixes mentioned in this thread, all of them. Still have my issue, which is to be precise.:

Land on home page, and add to cart from products displayed from widget.
First add to cart shows nothing in cart.
Second add to cart, works, and shows product that was first added

So basically, first producted is added but minicart is not populated.

Magento 2.1.4, Porto theme, using Varnish, Redis, all caches enabled

ihor-sviziev added a commit to ihor-sviziev/magento2 that referenced this issue Jun 26, 2017

ihor-sviziev added a commit to ihor-sviziev/magento2 that referenced this issue Jun 26, 2017

MAGETWO-53766: [github magento#4170] Product list widget doesn't upda…
…te minicart info

test fix

(cherry picked from commit 9efb5ad)
@magento-team

This comment has been minimized.

Copy link
Contributor

commented Jul 31, 2017

Internal ticket to track issue progress: MAGETWO-70218

@maderlock

This comment has been minimized.

Copy link

commented Aug 18, 2017

If this is being worked on, should this still be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.