0

I'm facing an issue on my Magento 2.3 website when I'm adding the product to the cart. I'm getting the success message ('Product Name' has been added successfully), but the mini cart on the top right count does not get updated to (1) and when the mouse hovers to it the box is showing empty with the message 'You have no items in your shopping cart'.

When I look at exception.log or system.log I do not see any error that could cause this only error I see is related to search ›

enter image description here

Hoping someone might have a suggestion on what would cause this. we have not made any edits to any of the cart or mini cart phtml or functionality files.

3 Answers 3

0

go to admin panel and enable it

admin -> stores -> configuration -> sales -> checkout -> my cart -> display cart summary -> display number of items in cart
1
  • thank you @bestestefan . When I go to that location there are no options shown. I tried changing to all the different store views I have but the admin panel just shows no optons?
    – Jayreis
    Nov 5, 2021 at 18:50
0

This should be related to the minicart not getting updated via customer data load call. On times developer do not think of Full page caching and overwrite this section with normal html code. Then if the page gets cached this value remains as is as its delivered from cache. So first check by disabling cache if the issue still persist. Or go to cart page and see if the cart has data.

This is more of an issue as template work was not done following Magento guidelines. All customer data is to be treated as private data and using AJAX it should be populated .You should enablet block hint and then check which block then compare that block with he original theme code.

2
  • Thank you. When I click the actual cart icon and go to the cart my items are there. It seems just the mini cart and icon are not updating.
    – Jayreis
    Nov 6, 2021 at 19:51
  • This is more of an issue as template work was not done following Magento guidelines. Nov 7, 2021 at 3:42
0

Try below solution:

Overwrite/copy copy vendor\magento\module-catalog\view\frontend\templates\product\view\addtocart.phtml into your theme at app/design/frontend/[vendor]/[yourtheme]/Magento_Catalog/templates/product/view/addtocart.phtml

Add below code by changing "bindSubmit": false to "bindSubmit": true.

<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": true
            }
        }
    }
</script>
<?php endif; ?>

Hope this can fix your issue. Happy coding!!! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.