Hi there, I am creating a logistic app whereby This User (users who login) will enter orders for multiple customers. I am having issues adding things to the cart correctly. I’d appreciate any help from anyone who has worked on a shopping cart before.
My data structure is as follows with some columns omitted for simplicity:
Product
Unique ID (default from Bubble)
Product Name
Orders
Unique ID (PK default from Bubble)
Customer Name
Cart
Unique ID (default from Bubble)
Orders (FK)
Product (FK)
Qty
Steps to create a new order is as follow:
- Fill in the customer information
- Add things to the cart.
Step 1
Step 2
The icon + and - is to add and remove items from the cart
I ran into an issue that when I clicked + for the first time, it’s adding 2 items to the cart instead of 1.
My workflow when the + button clicked is like this:
(1) If the cart does not have data with order-id as passed from the URL AND does not have the product-id = the current cell, then create a new Cart row.
(2) If Cart already has a row with order-id as shown in the URL AND product-id = the current cell, then update row by adding 1 to the Qty
Thanks