Newly loged in customer can view previous customer's Shopping Cart

This might related to how shopify implement its shopping cart.(in browser cache?)

I found on same computer same browser. If customer 1 log out then customer 2 log in. Customer 2 can see the product in customer 1’s shopping cart.

Is it the expected behaviour of shopify? It is not normal use case, but I feel it’s not a safe way to implement the shopping cart.

Hi,

Hope this will work

  • Auto-clear cart on logout (recommended)

Find theme.liquid (or sometimes layout/theme.liquid) and Add this JavaScript snippet

JavaScript example

{% if customer %}
  
{% else %}
  
{% endif %}