Forum Documentation Showcase Pricing Learn more

Create a shopping cart using custom states


I’ve looked around on the forums looking for a method to create a shopping cart using custom states. Since the “:PlusItem” feature does not allow duplicate entries, it was not possible to create a checkout method which adds multiple of the same item to the shopping cart. I’ve seen many posts and none addressed the issue ( Perhaps i missed them). After some testing, i realized i could create a data field in the Item/Product Database called “CartQuantity”. This field is adjusted via input when you add an item to the cart and this input is later taken to be multiplied with the price of the item allowing you to create a shopping cart in which all data is stored in custom states until the items are checked out and the information is copied onto a receipt database.

I’ll add a tutorial later if anyone’s curious.


Using custom states to store a cart is generally not a good idea.
When a user closes the browser before checkout the cart is lost.
It’s better to be saving the cart to thr database so that the user can always continue from where they left off even on a different device or browser.

Not sure where you got the plusitem idea from but normally you simply add or subtract from the quantity as you later said and you can save this into your database instead of a custom state.


Why not just create a data field that is a list, with another that is text

the list is the cart, and you can add things to the list.
the text is the user’s name, then you can do a search for “carts” whose userName = current user’s name