Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cart and Login session wiped when browser is closed #919

Closed
steve-jiang opened this issue May 22, 2023 · 6 comments
Closed

Cart and Login session wiped when browser is closed #919

steve-jiang opened this issue May 22, 2023 · 6 comments

Comments

@steve-jiang
Copy link

What is the location of your example repository?

hydrogen.demo or shopify.supply

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2023.4.1

What version of Remix are you using?

1.15

Steps to Reproduce

  1. Go to any hydrogen 2.0 stores, i.e. hydrogen.demo or shopify.supply
  2. Add something to cart or login
  3. Open another tab, can be blank
  4. Close the previous tab
  5. Open the same hydrogen store in another tab
  6. The cart and the login status persists
  7. Now close the browser
  8. Reopen the browser
  9. Open the same hydrogen store again
  10. Neither the car nor the login status persisted

Expected Behavior

Cart and Login session should persist when closing and reopening the browser.

Shopify online store persists the session when closing and reopening the browser.

Actual Behavior

Neither cart nor login session data persisted

This is especially bad when a customer uses a mobile device and they do the normal swipe up from the screen bottom and close an app. If they close Safari, the cart/login gets cleared. Can confirm this happens on both standard and private mode of Safari on IOS.

@blittle
Copy link
Contributor

blittle commented May 22, 2023

This is due to the demo store not using the session abstraction, and instead manually writing a Set-Cookie header. We are in the process of finishing a more full-featured cart abstraction which should resolve this when complete.

@steve-jiang
Copy link
Author

Thanks @blittle.

Isn't the new abstraction still setting cookies in the header?

I don't think this is related to cart implementation since all the session cookie is also not persisting after the browser is closed. This is affecting customer authentication as it logs out the customer after they close the browser.

I think the demo store forgot to set Max-Age or Expires when using the Set-Cookie in the header.

@blittle
Copy link
Contributor

blittle commented May 23, 2023

@steve-jiang you are correct, that will need to change.

@blittle blittle mentioned this issue May 23, 2023
7 tasks
@dcodrin
Copy link

dcodrin commented Aug 26, 2023

This is still an issue with the new cart abstraction and probably leading to some lost conversions, hopefully this is being worked on?

@dcodrin
Copy link

dcodrin commented Aug 26, 2023

Looks like we can pass cookie options as seen here which seems to fix the issue 🎉 :

// setCartId: cartSetIdDefault({maxage: 60 * 60 * 24 * 365}), // 1 year expiry

@michenly
Copy link
Contributor

michenly commented Feb 6, 2024

Close due to inactivity

@michenly michenly closed this as completed Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants