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

[16.0] Anonymous cart? #1510

Open
simahawk opened this issue Mar 5, 2024 · 6 comments
Open

[16.0] Anonymous cart? #1510

simahawk opened this issue Mar 5, 2024 · 6 comments
Labels

Comments

@simahawk
Copy link
Contributor

simahawk commented Mar 5, 2024

In v14 you could create a cart for an anonymous user by using backend.anonymous_partner_id.
The cart would then be swapped the real customer upon login.

What's the plan for v16?

CC @lmignon

@simahawk
Copy link
Contributor Author

simahawk commented Mar 8, 2024

@lmignon gentle ping :)

@sbidoul
Copy link
Member

sbidoul commented Mar 11, 2024

@simahawk I'm back from holidays, I'll try to get back to you later this week.

@sbidoul
Copy link
Member

sbidoul commented Mar 14, 2024

Hi @simahawk,

If you look at the demo app (#1364), there is a _get_cart_app_dependencies_overrides function that is used to set the right authentication mechanism (i.e. auth_jwt_authenticated_or_anonymous_partner_autocreate) on the cart routes.

That mechanisms either authenticates a known partner, or creates an anonymous partner and sets a cookie to identify it (see the shopinvader_anonymous_partner addon).

In v14 we had a single partner shared by all anonymous carts. With the new API, we create a new anonymous partner for each visitor that populates the cart: it should be simpler in the end, for instance when different anonymous partners are from different countries or such.

The last missing part is the conversion of the anonymous partner into a known partner (and transfer of the cart) upon signin. @qgroulard is working on it these days. The plan for that is in #1428 (comment).

@sbidoul
Copy link
Member

sbidoul commented Mar 14, 2024

See also #1368 for the whole authentication story.

@simahawk
Copy link
Contributor Author

@sbidoul thanks for the summary and the pointers! I'll have a look :)

@qgroulard
Copy link
Contributor

@simahawk Please have a look at #1523.
You'll see what we have done for the jwt authentication. The management of the anonymous partner and cookie and the transfer of the carts are done in dedicated modules, hence similar logic can easily be implemented for other authentication mechanisms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants