Why does my iPhone show 0 items in cart until I refresh?

Hi,I have a problem on my high edited theme ,the problem is only on my theme ,if I go for the clear theme I can t replicate it..So the problem is when you add a product in cart and you press back only on Iphone you ll have 0 items in cart until you refresh…thanks!

Hello @sao ,

Using JavaScript force ajax cart to show the correct count.
or we can say refresh the cart properly when customer use browser back button.
e.g.

if (performance.navigation.type === 2) {
// Call the theme cart function so cart works propery when back button used.
}

Thanks

Where I need to put this code?

You can use it in any JS file. But I suggest to use it with the existing cart drawer function.
It will run when you use browser back button.

And how I can find the card drawer js file?

Great question :slightly_smiling_face:
You can ask the theme support or ask a developer to check the theme code to find the file and the function.

Guleroa,and I forgot to say rhat I have this bug only on iphone