-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
When adding a product to shopping cart, it is not added to mini cart, but it is in /checkout/cart/ #5946
Comments
@jaimestuardo Thanks for reporting. |
Hello, problem started happening after last update. The problem that existed before was that the cart items indicator always was present in mini cart even when no items are in it. After upgrade to 2.1.0, this new problem happened. I have only 1 store view. This problem happens when trying to add a product to cart in both logged in or not logged in. If you need to see the problem in action, just load: http://qa2016.depasa.cl/productos.html After loaging that page, this JavaScript error is shown in console_ I don't know why that error is produced now, because other times, a JavaScript error concerning cart were shown. |
Any solution? |
@jaimestuardo @diglin |
I was using Magento 2.0.x and it had another problems that I needed to have fixed. So, when 2.1.0 version was released, I have upgraded. Most problems were solved, however, this another problem started happening. This is crucial to be solved as soon as possible. |
Same as @jaimestuardo except that issues are still on 2.1.0. No varnish. PHP 7 installed on a vagrant VM |
Any update on this? |
Finally I could know what was happening. The problem was strange, however. I have a custom template. That custom template had minicart.phtml in its design folder. Well, the only difference between this phtml and the default phtml is that I had added a new style class in the outer div. To test I have deleted that new class from the div and the page still did not work. So, finally, I deleted the minicart.phtml from my custom template, and magically it started working. Therefore, the solution was to change my custom css file to change the minicart style, instead of adding a new class and customizing the minicart.phtml template. Why was this? I don't know, but it did work, at least. Thanks |
Same Issue here:
Solution of @jaimestuardo is not working for me |
@sweikenb what are the steps after the installation? Which theme do you use? Are there any errors in browser console? What is server response on "add to cart" click, when request is sent? |
Same Issue here: PHP 7 Standard template Magento/luma Any solution? |
Same Issue here: PHP 7 Standard template Magento/luma |
Any update? Same Issue here: PHP 7 Standard template Magento/luma |
The issue can be temporary fixed by enabling the full page cache even without using Varnish |
@diglin How can Magento2 live with such a nasty bug? don't they have Q&A testing before they release? |
@treestonemedia there are tons of unit testing on PHP side. I don't know how they handle testing on frontend side part. It's quite a complex software with tons of possible combination, so I find difficult to test all of them. The worse is not that, we provide feedbacks and the issue in the latest release is still there. |
@diglin Is there a way to prioritize issues? we cannot "Sell" Magento2 when basic things like this don't work. |
@treestonemedia I don't know, Magento people decides themselves, which makes more or less sense. |
This bug still appears in a fresh install of Magento 2.1.2. Some details: Magento: 2.1.2 virtual host:
clean install Steps to repeat: The minicart shows "You have no items in your shopping cart." See screenshot: Magento, please try to fix this problem, I have spent some considerable amount of time trying to fix it myself, but minicart code is complex. system.log:
There are no javascript errors. The error also occurs sometimes when the user is logged in. It happens always when a logged in user adds items to his cart, logs out, and then logs in again. The items are still there, as witnessed by the checkout page, but the mini-cart says there's no items. |
I'm facing the same bug on local:
Empty minicart until checkout is reached. Steps to reproduce:
|
@ShubhSikarwar It doesn't matter what I change the base URL to, I still have the issue. Frustrating that this has been open for 6 months and there has no progress or updates. |
@nathanjosiah Have you tried turning on full page cache like @ReadySteadyFlow suggests? It looks like it's solved the issue for me (possibly along with the base URL change) |
In my case the override files //edit: The function |
Dear Magento Core Team, Please can we have an update on this thread? Here is my suggested solution (I think other solutions are possible, see analysis below): Proposed solutionIn file:
Code change:move
outside of its enclosing so that storage invalidation keys are always tested and reloaded if non-empty So now the psuedo code looks like this:
That is, change the code to look like this:
Here is my analysisThis is a long and confusing bug report trail. I think that is because it is not an easy bug to understand and it changes depending on a number of things. In particular many people suggest turning the page cache on solves this problem. I agree that solves the problem because if the page cache is turned on then in the function
How to repeat this bug:Standard M2 install. Disable all caches. In the Magento Admin set 'sales->checkout->shopping cart->after adding a product redirect to the shopping cart' to yes. Now visit the front end. Navigate to a product view page, clear your cookies. Refresh the page. Now press the 'add to cart button'. Here is what I observe: Listener sets browser local storage key Let's step through the logic of that function customerData.init():
And hence the cart section data is not loaded and mini-cart does not update. ---o0o--- Now refresh the page:And let's step through the logic of that function
---o0o--- Recap:
Proposed solution:
Logical argument for proposed solution:If there are any invalid storage keys at any time, why not reload them from the server? Final summary:Please review the intended logic of Note:This may relate to issue #5144 Some pedantry if you got this far:The object
But often |
I have more to add on repeating the problem of mini-cart not updating. Another way to replicate the problem: a) Standard M2CE install
f) The mini-cart does not update. I suspect product comparison and customer data and any messages don't update either. (all because the page cache is off AND So you can remedy this by turning pageCache on or, better, moving the lines of
I think that is the best way to fix this bug in the core file. Meanwhile I am using
|
Still happens on 2.1.6, how to fix this? |
The same problem on 2.1.6. |
Found this solution. Please check if it helps. |
@Tonop if you want to experiment please edit the core file module-customer\view\frontend\web\js\customer-data.js and move lines 207, 208, 209 to be outside that block to line 211 so that the invalid storage keys are are always reloaded. (as per my comments above)
I would be interested if this solves the problem of the mini cart not updating. If it does I will make a pull request for that code change. If it does not, please explain your situation in some detail. Particularly any theme customisations. |
@malachy-mcconnnell Do you want to elaborate with some details: Magento version: 2.1.6 |
Do you want to elaborate with some details: Magento version: |
@malachy-mcconnnell I tried your workaround, not work for me (2.1.6) |
@jaimestuardo, thank you for your report. |
Issue with 302 redirect like in #5946 (comment) still happens in v2.2.2. Change domain from top-level to second-level fixes it (in my case from |
I'm facing same issue on my live website, after adding product mini cart, cart and checkout all pages are showing empty. Can you help me regarding about this issue. I'm using magento 2.3.0 Thanks |
[TSG-Commerce] Tests for 2.3 (pr23)
Steps to reproduce
Expected result
Actual result
When inspecting JavaScript in Google Chrome developer tools, I found this when I load the catalog:
Uncaught TypeError: Unable to process binding "css: function (){return { empty:cart().summary_count == 0} }" Message: cart is not a function
in knockout.js.
The text was updated successfully, but these errors were encountered: