Clear cart after transaction

Hi,
I’m setting up an e-commerce type app.

I’ve got three collections.

Users
Order Items
Orders
Similar to how the template food truck works.

User creates order items when adding to cart,
When checking out I create an order with all the order items that belong to that user.

My issue is with how to delete the order items after the transaction has been set as successful.

Am I’m missing something?

bump up.
Can someone help please.

Hi @designedhead,

In my experience, after user places an order I prefer to leave order + order items for future reference, and then create a new cart.

I.e.:

  • user starts shopping, new Order is created
  • user adds item to cart, the OrderItems records are created and linked to Order
  • user checks out, Order is marked as complete
  • user returns to main screen - another order is created.

Best regards, Victor.

Thanks Victor, But once the order is completed and a new one is created. How do we ensure the items from the previous order won’t show up?

Hi!
You can put on the button to start the order “create a new order” and then, “Add new items to the current order”

this prevents you from viewing the items of the order already placed.

I hope this can help you

1 Like

Hi @designedhead,

They shouldn’t - how would they appear in the new one, there are no links to them.

If you want to remove the items from the shop (they’re sold in single items), that is a different story.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.