Click minicart icon
Display content of cart

No Javascript errors of any kind. Navigating to /checkout/cart/ displays the content properly.
What are your cookie domain settings? The reason could be a wrong cookie domain. In most cases it should match with the base url. For example .yourserver.com.
We have noticed the same issue whilst upgrading from 2.0.7 to 2.1
A lot seems to have changed in 2.1 regarding the checkout, disabling our theme seems to resolve the issue but still haven't fixed the issue.
We also found that going to /checkout/cart then clicking the back button would populate the javascript cart object and the mini cart would then work.
@jzahedieh Yep, and occasionally messages would get stuck so you end up with two or three "You added x to the card." at the same time.
vendor\magento\module-catalog\view\frontend\templates\product\view\addtocart.phtml
Here the fix:
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"Magento_Catalog/product/view/validation": {
"radioCheckboxClosest": ".nested"
}
}
}
</script>
<?php if (!$block->isRedirectToCartEnabled()) : ?>
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"catalogAddToCart": {
"bindSubmit": false
}
}
}
</script>
<?php endif; ?>
Change to
<?php if (!$block->isRedirectToCartEnabled()) : ?>
<script>
require([
'jquery',
'mage/mage',
'Magento_Catalog/product/view/validation',
'Magento_Catalog/js/catalog-add-to-cart'
], function ($) {
'use strict';
$('#product_addtocart_form').mage('validation', {
radioCheckboxClosest: '.nested',
submitHandler: function (form) {
var widget = $(form).catalogAddToCart({
bindSubmit: false
});
widget.catalogAddToCart('submitForm', $(form));
return false;
}
});
});
</script>
<?php else : ?>
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"Magento_Catalog/product/view/validation": {
"radioCheckboxClosest": ".nested"
}
}
}
</script>
<?php endif; ?>
I tried the patch from zhiyicai
but alas, I still have nothing in the minicart, the cart page is fine though.
Is there any update on a proper fix for this?
[https://github.com/magento/magento2/issues/5144]
vendor\magento\module-catalog\view\frontend\templates\product\view\addtocart.phtml
You simply need to change
"bindSubmit": false
to
"bindSubmit": true
The initial value in the old code was overridden by the code in the inline script. However if you actually look at the widget itself you will see nothing happens if bind is set to false. NOTHING it's like the widget doesn't exist. How this was missed is just beyond comprehension. Unbelievable
Hopefully the above fix is a much better one than simply adding in the old code.
Hi @samuellinde , thanks for reporting this issue. Internal ticket MAGETWO-57884 was created.
Best,
Anton.
I'm new to Magento 2.X and I have the same issue with the mini cart. If I update the code, how will that effect composer or upgrading in the future? I know in Magento 1.x you don't touch the core.
Hi, guys, I tried to reproduce this issue, but in my case, all work as expected.
Magento 2.0.9 was installed via composer, then upgraded to 2.1 (via composer). Minicart shows all products and indicator shows the number of products in mini cart.
Can you provide more information and steps for reproducing?
I haven't experienced this issue in firefox, but in chrome yes, even on 2.1.1. The fix provided by fhennessy solved it.
@SewHappy58 You want to copy vendor\magento\module-catalog\view\frontend\templates\product\view\addtocart.phtml and change line 57 from
"bindSubmit": false to
"bindSubmit": true
and then add it to your theme at /app/design/frontend/[vendor]/[yourtheme]/Magento_Catalog/templates/product/view
Hi guys, Me also face the same issue, But In my case it was happened in some times only.
Steps to reporoduc the issue:
My magento version is 2.1.1
1.Add one product to cart
2.Product sucessfully added to cart also in mincart
3.Some times while you added to cart product added sucessfully and shown on cart page but not added in minicart
@ewallkrishnaprakash are you getting any errors in your exception.log?
also compare your vendor/magento/module-checkout/view/frontend/web/template/minicart/content.html
to
https://github.com/magento/magento2/blob/develop/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html
Could this be a duplicate of #6882? Is Full-page Cache disabled?
i have tried this fix (putting binSubmit to true) so i can have ajax add to cart working, but i am having another issue, Error messages are not showing ( success message are ), for example i try to purchase more qty than the product has, it wont tell me anything, no message error at all. Anyone else ?
When did this problem first occur? I tested thoroughly from my initial installation in 2.0 but now discovered in 2.1.2 that I cannot login properly. Says Welcome (name) but still shows login links. I login and and try to checkout, I get logged out. I try to review past orders after logging in and I get redirected to being logged out. What the heck is going on with Magento?
This issue is fixed to me when I upgrade my PHP version from 7.0.9 to 7.0.15.
I'm using PHP V 7.0.15 and issue persists. I tried @fhennessy and and @zhiyicai fixes, but problem persists.
Is this issue still actual?
We were not able to reproduce it.
Internal ticket to track issue progress: MAGETWO-70218
I see this issue has since been closed. Can anyone advise the exact version the fix has been pushed to?
Hi Team,
I am facing the same issue in Magento 2.2.4 version. Could you please check and let me know.
Hello Team,
Already tried all the option but still facing same issue.
is there any other solution ??
Most helpful comment
I see this issue has since been closed. Can anyone advise the exact version the fix has been pushed to?