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

"No items" in minicart in 2.1 #5377

Closed
samuellinde opened this issue Jun 30, 2016 · 24 comments
Closed

"No items" in minicart in 2.1 #5377

samuellinde opened this issue Jun 30, 2016 · 24 comments
Labels
bug report Component: Checkout Fixed in 2.1.x The issue has been fixed in 2.1 release line Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update

Comments

@samuellinde
Copy link

Steps to reproduce

  1. Add product to cart
  2. Click minicart icon

Expected result

  1. Display content of cart

Actual result

  1. screen shot on 2016-06-30 at 14-02-10

No Javascript errors of any kind. Navigating to /checkout/cart/ displays the content properly.

@tobias-forkel
Copy link
Contributor

tobias-forkel commented Jul 1, 2016

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.

@jzahedieh
Copy link

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.

@samuellinde
Copy link
Author

@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.

@zhiyicai
Copy link

zhiyicai commented Jul 4, 2016

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; ?>

#5144

@shanevbg
Copy link

shanevbg commented Jul 17, 2016

I tried the patch from zhiyicai
but alas, I still have nothing in the minicart, the cart page is fine though.

@ghost
Copy link

ghost commented Jul 21, 2016

Is there any update on a proper fix for this?

@fhennessy
Copy link

[https://github.com//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.

@antboiko
Copy link

Hi @samuellinde , thanks for reporting this issue. Internal ticket MAGETWO-57884 was created.

Best,
Anton.

@antboiko antboiko added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Aug 31, 2016
@SewHappy58
Copy link

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.

@sidolov
Copy link
Contributor

sidolov commented Sep 8, 2016

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?

@ghost
Copy link

ghost commented Sep 8, 2016

I haven't experienced this issue in firefox, but in chrome yes, even on 2.1.1. The fix provided by fhennessy solved it.

@fhennessy
Copy link

@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

@ewallkrishnaprakash
Copy link

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

@fhennessy
Copy link

@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

@dnadle
Copy link

dnadle commented Nov 11, 2016

Could this be a duplicate of #6882? Is Full-page Cache disabled?

@cefrigo
Copy link

cefrigo commented Nov 13, 2016

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 ?

@flnative
Copy link

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?

@rafaelstz
Copy link
Member

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

@dharake
Copy link

dharake commented May 23, 2017

I'm using PHP V 7.0.15 and issue persists. I tried @fhennessy and and @zhiyicai fixes, but problem persists.

@veloraven
Copy link
Contributor

Is this issue still actual?
We were not able to reproduce it.

@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 Component: Checkout Progress: needs update labels Jul 31, 2017
@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Checkout Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Progress: needs update labels Sep 11, 2017
@magento-engcom-team magento-engcom-team added Fixed in 2.1.x The issue has been fixed in 2.1 release line Fixed in 2.2.x The issue has been fixed in 2.2 release line labels Sep 18, 2017
@sammarcus
Copy link
Contributor

I see this issue has since been closed. Can anyone advise the exact version the fix has been pushed to?

@Sathishkumar8731
Copy link

Hi Team,

I am facing the same issue in Magento 2.2.4 version. Could you please check and let me know.

@Anantkprajapati
Copy link

Hello Team,

Already tried all the option but still facing same issue.

is there any other solution ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Checkout Fixed in 2.1.x The issue has been fixed in 2.1 release line Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update
Projects
None yet
Development

No branches or pull requests