2

We have a strange behavior in our store in the mini cart. If I add some items to cart then navigate somewhere and after couple minutes content of mini cart disappears. If I add something again to mini cart - I will see all my previous items again.

Our team checks https settings (all store under https), cookie settings, session settings, cache settings etc. Nothing helps. Same thing always. Any thoughts what it could be?

M2 version: 2.1.2

1 Answer 1

1

That is magento2's default bug

https://github.com/magento/magento2/issues/5377

https://github.com/magento/magento2/issues/4170

for the temporary solution, you can refresh mini cart in all page for that you can use below code.

default.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  <body>
    <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="refresh.minicart" template="{vendor}_{module}::refreshMinicart.phtml"  />
    </referenceContainer>
  </body>
</page>

refreshMinicart.phtml

<script>
  require([
    'Magento_Customer/js/customer-data'
  ], function (customerData) {
    var sections = ['cart'];
    customerData.invalidate(sections);
  });
</script>
0

Your Answer

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

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