I want to modify each item that is shown in the website

Im making a website to distribute redeem codes, but the thing about that is once someone has the code, it can’t be used again, so,
I need a way to “mark off” the codes that have been shown to the viewer. Any idea on how to go about doing that?

A method I was thinking of is,

  • I have a collection of all the codes with a boolean in the next column

  • ill have the collection linked to a text box with a filter to only show the codes with a false boolean

  • once a code is shown, I need that boolean to be changed to true, so that no one else will get it

ps; i have never coded before and dont have any clue what going on, any help is truly appreciated :slight_smile:

Your idea is absolutely —> CORRECT <—!!!
You will need a DATABASE (i hate this word → COLLECTION <—), where you will store all your data.
Also in your database you will have (like you already said) a boolean-Data-Field.
This field will determine if an ITEM is → true or false (if someone already have seen or not).

You will have to work either with Wix-Data-Api, or you try to set it up, by usage of DATASET.

  1. Wix-Data-API → more flexible way.
  2. DATASET-Way → less time-consuming and beginner-friendly (not really) :grin:

There are thousands of examples about → how to work with databases inside this forum.
Use the SEARCH of this FORUM to get what you need.

Based on your requirements , here is an approach you can take to mark off the codes that have been shown to the viewer :

  1. Create a collection: Set up a collection that includes all the codes you want to distribute. Add an additional field, let’s call it “isShown,” to keep track of whether a code has been shown or not. By default, set the value of “isShown” to false for all codes.

  2. Filter the collection: Link the collection to a text box and apply a filter to only display the codes where the “isShown” field is false. This ensures that only the unredeemed codes are visible to the viewer .

thanks a alot, i’ve found a playlist explaining the wix data api, i hope that will get me up to speed on this :slight_smile:

I’ve got the code working perfectly :ok_hand: using the wix-data api.
i can share the code and explain how it works if anyone would like :wink: