Shopping cart functionality with variable

I want to users can add product to cart without regestration. I believe variables are a good fit for this purpose but i cant create action that adding +1 item from collection list to variable by clik on button into collection item.

There is no quantity,one item can only be purchased in one copy, so i want just add and delete products from cart and be able to display this products in cart and use them for checkout.

Please help me to solve this issue. I would really appreciate your help and any advice you can offer. Thank you in advance for your time and effort!

I tried to use arrows and objects for variableas, but I have problems with displaying list of data from variable…

There are many ways to do this.
this is one example (it’s with quantities but it’s the same principle)

Another simple way would be to have an array as variable to keep track of the products, and then use array functions to add/remove a product. Keep in mind that in this case you want to store a simple value like a string in the array.

I am trying to do it the array way, but only one product is displayed. Could you suggest what I’m doing wrong?
Uploading: Screenshot_1.png…
Uploading: Screenshot_2.png…
Uploading: Screenshot_3.png…
Uploading: Screenshot_4.png…
Uploading: Screenshot_85.png…





Screenshot_4

The simplest way of doying this, if you don’t need quantities, is, as I said, an array of ids (strings).
It looks like you are creating an array of arrays of strings.
To add a product insert the id at the beginning.
To remove a product replace the whole array and use the “remove” function as described in the docs.
In the end you want something like ["prod-id-1","prod-id-2"] and use the id to lookup the product data.