Simple shopping cart with Phoenix?

Hey I am trying to make a very simple shopping site with elixir/phoenix, and I have the items done, but how can I make a shopping cart that can have multiple instances of the same item?
I had a few thoughts, like having just sort of “global” list what gets created empty on start and then items get added to it, but in order for that I would need to be able to store it’s current state somewhere outside the def where I am adding items to it.
other idea is that have a struct and save the id’s of the items of the items to the database but the problem with that is that I would need to create the cart itself on the page so that I can add items to it.

Wat do you guys think?

1 Like

Can’t you just add a Quantity attribute for the items?

1 Like

Actually I think that might be the way to go, thanks


This seems interesting:

1 Like