Passing info from an unlogged-in user to the same user after they log in

Are you talking about logging in or signing up (you mention both, but they’re very different problems)…

send a user back to the page they were on before they tried to log in

I don’t know exactly what you’re trying to do, but this should be simple enough to do with URL parameters (although you could use a session cookie)…

or persist a shopping cart after they create an account.

This shouldn’t be an issue - Bubble handles this automatically, so no need to do anything - as long as the cart is attached to the current User… it will automatically stay attached to the User after they sign up (it’s the same User, after all)…

However, if you’re talking about persisting a shopping cart to an existing User (who isn’t logged in) AFTER they log in, that’s a different issue entirely (as Bubble won’t see them as the same User, but rather 2 different Users)…

Using a simple Cookie (storing a reference to the Shopping cart) is all you need to deal with that (or you can use Local Storage)… then when a User logs in you can check their cookies (or local storage) to see if there is a cart stored there, and if so, assign that cart to the logged in User…

Here’s a great explanation of the basic approach: How to attach anonymous data to existing user after they log in? - Need help / Database - Bubble Forum

2 Likes