hi, I’m sorry, but it’s 1 week that i try, but i don’t see any solution so if you know, please help me.
i’m tryng to create an order app, but i have issues with the cart: the product are correctly add to the cart and they can be “buy”, but when the order is completed, the object in the cart still remain and i can’t find a way to remove them
i stuctured the app in this way: when you want to buy a product, clicking on the “buy botton” will create an “order object”. every users has an “order” that is created every time an order is complated (so you always have an active order). in the cart section you have a list of order object that with a toggle you can add to the order and so buy it.
It depends on you database structure, you could have order header which have order id, date and relationship field to users as customer, then you can have order detail which have product, quantity, price that is linked to order header.
So, whenever customer buy, it would add to order detail, and whenever customer pay, the new order header is created, so the whole order detail becomes blank again, because old order details are linked to old order header.
New order header will make blank order details, your old order header is still there with its linked order details.