3

When login with social login like Facebook, Gmail, the mini cart items count is showing 0 and when I click on cart page then it will reload the count.

In Default Magento Login is working fine. Please refer my below screenshot for reference.

enter image description here

enter image description here

5

1 Answer 1

0

I'm not sure about your custom logic on header. By default, the mini cart on header will get data from localstorage.

I have some suggestions:

1) Reload the cart section.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd">
    <action name="sociallogin/popup/customer">
        <section name="checkout-data"/>
        <section name="cart"/>
    </action>
</config>

2) The mini cart on header gets data from localstorage. We should follow the localstorage logic.

vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml

3) Browser cache

Status Code: 200 OK (from disk cache)
...
Pragma: cache

200 (from memory cache) - file found in browser, so browser is not going request from server

enter image description here

https://stackoverflow.com/questions/1665082/what-is-the-difference-between-http-status-code-200-cache-vs-status-code-304

Magento 2 comes from with Varnish cache. Using Varnish on your server can resolve the disk cache issue.

https://book.varnish-software.com/3.0/HTTP.html#pragma

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.