-
When I add items to cart, close the browser (I use Safari or Chrome). Wait 10 seconds. Reopen the browser. Cart items are gone. Seems like this does not happen when you use your myshopify store domain, only on the custom domain. Anyone experiencing the same issue? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I still have items in the cart since yesterday? I just ran the local env. |
Beta Was this translation helpful? Give feedback.
-
I just realize that in session.server.ts, there is no maxAge property set. Because of that, session cookies only last 1 second thus making the cart items disappear when the browser is closed. By adding the maxAge property and setting it to 2 weeks (1209600 seconds), this issue doesn't happen anymore.
|
Beta Was this translation helpful? Give feedback.
I just realize that in session.server.ts, there is no maxAge property set. Because of that, session cookies only last 1 second thus making the cart items disappear when the browser is closed. By adding the maxAge property and setting it to 2 weeks (1209600 seconds), this issue doesn't happen anymore.
static async init(request: Request, secrets: string[]) { const storage = createCookieSessionStorage({ cookie: { name: 'session', httpOnly: true, path: '/', sameSite: 'lax', secrets, maxAge: 1209600, }, });