Cart items disappear on refresh
Cart items should persist across page refreshes. If they're disappearing, here's how to fix it.
How cart persistence works
TGC stores cart data in localStorage. When you refresh or navigate:
Page loads
TGC runtime initialises
Cart state is restored from
localStorageComponents display the saved cart
Common causes
1. Private/incognito browsing
Private browsing modes often block or clear localStorage.
Fix: Test in a normal browser window. This is expected behaviour in private mode.
2. Browser blocking localStorage
Some browsers or extensions block storage.
Check:
Open browser dev tools (F12)
Go to Console
Look for errors about "localStorage" or "storage"
Fix:
Disable storage-blocking extensions
Check browser privacy settings
Try a different browser
3. TGC runtime not initialising
If the runtime doesn't load, the cart can't restore.
Check:
Open browser dev tools (F12)
In Console, type:
window.__tgcIf it returns
undefined, the runtime isn't loading
Fix:
Make sure you have at least one TGC component on the page
Check for JavaScript errors in the console
Republish your site
4. Multiple domains or subdomains
localStorage is scoped to the domain. Cart data on www.mysite.com won't appear on mysite.com.
Fix:
Use consistent domain (with or without www)
Set up redirects to your preferred domain
5. Credentials not injected
Without credentials, the runtime partially fails.
Fix:
Open TGC plugin
Verify you're connected
Republish your site
Debugging steps
Add item to cart
Open dev tools → Application tab → Local Storage
Find your site's domain
Look for a key like
tgc_cartRefresh the page
Check if the
tgc_cartkey is still there
If the key disappears on refresh, something is clearing storage.
Testing cart persistence
Open your live site
Add 2-3 items to cart
Open cart drawer — verify items are there
Refresh the page
Open cart drawer again — items should still be there
Navigate to a different page
Open cart drawer — items should still be there