0

After Login , customer data is showing from previously logged-in customers data in dashboard , orders, address etc, even after clearing the cache / trying in new private window

2
  • I faced this same issue previously, it depends where are you showing cusotmer data. I mean is that page cacheable? Magento2 doesn't refresh cache on all pages. Feb 9, 2019 at 7:26
  • Also how to are fetching customer data, you need to use magento way to do that i.e. customerData.js. It will be great if you can show how you are getting data. I mena you need to show some code that you have done till now Feb 9, 2019 at 7:28

1 Answer 1

0

You need to use Private content in order to see customer information on cachable pages.

For example if you need to show customer name on dashboard after login you will get such issue of showing wrong name becasue that page is been cache already by full page caching.

So there are two ways to do that:

  1. You can put that block to me cacheable = false, but that is not recomended beacuse that will remove that whole page from full page caching.

  2. You can use customerData.js in order to retrieve logged in customer data.

If you need to show order and invoices of logged in customer on dashboard, I would suggest to get data from an ajax response instead of getting data from customer session.

Have a look here: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/cache/page-caching/private-content.html

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.