Shopping Cart without Login

Hi, everyone:

I am attempting to add a shopping cart page to my app, so I am watching some YouTube videos on the topic. In the videos I have watched so far, the User/Buyer needs to login to the Bubble app to access the cart and purchase. However, I have been to many ecommerce website for large retailers in which I can access my cart as a guest without logging in. I need to allow people to be able to see their cart and purchase without logging in. Is that possible in Bubble? How?

Thank you.

UPDATE: So I’ve done a little more research on this, but would still like input on this. Because I need to allow guests to be able to make purchases, I believe I need to create a temporary shopping cart for them. These guests do not have login accounts with us (they are not in the User data type), so their carts cannot be attached/stored to any account. Right now, I have a Shopping Cart data type, but then wouldn’t cart from different users interfere with each other? Now, I read that it’s a bad idea to store shopping carts in custom states because the info is gone when page refreshes among other reasons. The other option I was thinking is using local storage which I have never used before. Does this mean having a cookie? Do I need plugins to do this? Any thoughts would be great. Thank you.

I’ve made something that had this functionality, and my basic understanding is that when a user goes to your app it creates a user in the database even if they are not logged in, this is stored as a cookie in their browser so when they return to your app (and before the cookie has expired) you can set up your app to show the basket linked to that user.

The cookie lasts for 3 days or something, it probably states in the Bubble Manual.




And I’m assuming you created a data type called shopping cart to store the products this un-login guest is trying to purchase…?

Yes… something like that from what I can remember. When a new page loaded it created a new basket for that user unless if the user already existed it would load the basket already associated with that user.

Hope this is helpful for you. Interested to see how you solve the problem :slight_smile:



yes. you can do it with workflow or privacy rules.

I heard you like watching videos, so… Learn about browser storage:

1 Like

you can use the coockie plugin or I used a better and simpler method. I am not sure what it is but this is how i did:

When add to basket is pressed - create a new datatype thing using the current users unique id. So that way a new user is in your database but not registered.

You have to make a datatype. I named it Temp-user

and then i am storing a datatype in that data type for products.

I will have to find a way to delete the temp user after 3 days of inactivity or something similar.

Let me know if any questions