Hey guys, i have taken all these tuto online on shopping app and i am trying to build some controls around shopping cart and i really dont know where to look at.
I am trying to basically use my app State variable Cart (which is a document item + a quantity) but not sure how to implement 2 things :
i would like to be able from the item view to retrieve the item form the cart if it exist and load the quantity from the cart on the view page (example: i have already adeed that item with a quantity of 2 in my cart) so when i open the item page, it says 2 already in the qty
when i add to the cart from that view page, instead of creating a new entry in the cart with new quantity, i just want to retrieve the one that was added, and update the quantity
not exactly sure how to do this. i can supply screenshot if that helps on my pages and what i have tried so far, but i am more looking at conceptually how to manage this.
the cart is an appstate variable so on the item page, do i create an action when the user click on add to cart which will go and look for that item if it exists already in the cart and update the quantity of it ? sorry if i am confusing. :)