I have a recently viewed block, it works fine with registered users and with guest users, but when guest users close the browser and enter the web again, the recently viewed products are empty.

I need to keep the recently viewed for guest users in a cookie to retrieve them when comes back to the page.

But I do not find where the function getRecentlyViewedProducts() is, or any other code to store and retrieve recently viewed products.

I know that logged users save their recently viewed products in report_viewed_product_index, but I'm not sure how are stored with guest users... maybe in session?

magento version:


I changed the configuration of the cookie in the magento admin>system>config>web>Session Cookie Management.

I had cookie path empty, cookie domain empty, use http only set to no and a low time of cookie (3600). Now this is the new configuration, and seems to work correctly.

enter image description here

It's strange because the cart worked properly when close and reopen, I only lost the recently viewed items... but now everything seems ok.

  • If the recently viewed product list is clearing over a browser restart, it sounds like your session cookie isn't being stored? If an unsigned-in user puts an product in their basket and then restarts the browser, is the basket still there? – Richard Apr 12 '18 at 10:53
  • If unsigned, I add a product to the shopping cart, I close the browser and when I reopen it again the product is still in the cart. – Alex Apr 13 '18 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.