Need Help : with Unique User Identification in Anonymous Shopping Cart

Hello everyone,

I am facing a challenge in my Bubble app related to unique user identification for anonymous shopping carts. Here’s a detailed description of the issue:

Problem:
In my app, I have a database called “Cart” with columns such as “Product Name,” “Price,” “Order ID,” and “User ID.” Users can add products to their shopping cart, and the “User ID” column is meant to store a unique identifier for each anonymous user.

Desired Behavior:
When an anonymous user adds a product to the cart, I want to generate a unique identifier for that user and store it in the “User ID” column of the “Cart” database. This way, I can link each product in the cart to the specific user, even if they are not logged in.

Current Challenge:
I am struggling to find the best way to generate and store this unique user identifier in the “User ID” column of the “Cart” database. I want to ensure that each user’s cart remains separate and identifiable, even if multiple users add products to their carts at the same time.

What I’ve Tried:
So far, I have attempted to use the “Generate random string” function in Bubble to create the unique identifier. However, I am having difficulty understanding how to link this identifier to the specific user’s cart and store it in the “User ID” column.

Request for Assistance:
I would greatly appreciate any guidance or suggestions on how to achieve this unique user identification for anonymous shopping carts in Bubble. If you have any insights or examples of workflows that could help, please share them with me.

Thank you in advance for your help and support!

Best regards,

Hi @saas.paytab :wave:

The best way to do it is using cookies :wink:.

Thake a look in the plugin Local Storage & Cookies. It is free.

image

Every Time a user opens your App you save a CookieID in his browser, so you now can identify him in every access.

Thank you for your help , I’ll try to manage with cookie .

Have a nice day