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
Closed

Magento2 Mini Cart Items Issue #4170

wclansar opened this issue Apr 15, 2016 · 70 comments
Assignees
Labels
bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@wclansar
Copy link

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
Copy link
Contributor

@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
Copy link

ansarhusain commented Apr 15, 2016

Hello i am using magento 2.0.4

There is not error in console.

@sdzhepa
Copy link
Contributor

sdzhepa 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
Copy link

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
Copy link
Contributor

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
Copy link

krlecarp 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
Copy link
Contributor

Internal issue MAGETWO-53432

@BeniSt
Copy link

BeniSt 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
Copy link

Thanks for reporting issue. Internal ticket MAGETWO-53766

@SerhiyShkolyarenko
Copy link
Contributor

SerhiyShkolyarenko 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
Copy link

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
Copy link
Contributor

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

@grasdaggel
Copy link

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

@thills03
Copy link

thills03 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
Copy link

BeniSt 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
Copy link
Author

wclansar commented Jun 2, 2016

Hello BeniSt ,

can you check is your cache disable ?

Because it seems that issue comes when cache off .

Thanks

@grasdaggel
Copy link

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

@BeniSt
Copy link

BeniSt commented Jun 2, 2016

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

@wclansar
Copy link
Author

wclansar commented Jun 2, 2016

Welcome Brother BeniSt !!!!!!!!

@SerhiyShkolyarenko
Copy link
Contributor

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

@thills03
Copy link

thills03 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
Copy link
Contributor

@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
Copy link

filipac commented Sep 2, 2016

is there a known fix for this?

@mombrea
Copy link

mombrea 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
Copy link
Contributor

kanduvisla 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
Copy link

mombrea 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
Copy link
Contributor

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

@bvboas
Copy link

bvboas commented Sep 12, 2016

The commit for the fix is here: 861f596

@RishabhRkRai
Copy link

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
Copy link

wojciechowskid commented Oct 19, 2016

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

The same for 2.0.10

@pyyick
Copy link

pyyick commented Oct 26, 2016

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

@SantoDE
Copy link

SantoDE 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
Copy link

DRAJI commented Jan 17, 2017

Enable caching is working for me. Thanks @wclansar

@dambrogia
Copy link

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
Copy link
Member

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

@rajesh0608
Copy link

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

Thanks...

@FloWord
Copy link

FloWord commented Mar 17, 2017

My Solution for refresh Problem:
#5377

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

@malachy-mcconnell
Copy link

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
Copy link

Still happens on 2.1.6, how to fix this?

@Tonop
Copy link

Tonop commented Apr 28, 2017

I see it in 2.1.6 too.

@dharake
Copy link

dharake 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 pushed a commit to ihor-sviziev/magento2 that referenced this issue Jun 26, 2017
ihor-sviziev pushed a commit to ihor-sviziev/magento2 that referenced this issue Jun 26, 2017
…te minicart info

test fix

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

Internal ticket to track issue progress: MAGETWO-70218

@magento-team magento-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report labels Jul 31, 2017
@maderlock
Copy link

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
Labels
bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests