Collections: How to change text based on conditions?

Hi
Is the a way to output Text depending on a condition of a collection-field?

Example:
A table of product items.
If an item is sold, then I want to output only the text “sold” insteat of the actual price-text.

Is this possible with Webflow-Onboard-Tools?
Or do I need to solve this with custom code?

Kind regards
Alain

Hey Alain,

You should be able to add a condition based on if the quantity of the product is zero, so therefore has been sold

This link should help:

Hey David
Your Link is about Visibility but I need something like
if quantity = 0 then element.innerText = ‘sold’;

Is that possible?

I would duplicate your text element, have one link to the price and unlink the other. Make the unlinked say “sold” then have the condition of quantity not equal to zero hide it, then another condition on the original text to hide the price when quantity is zero

1 Like

Thanks.
I was thinking about a similar solution.
Was just hoping that there is a more elegant solution :slight_smile:

1 Like

Hitting the same road block building a quiz not using forms. I’m going to try airtable and nocodeapi to translate the image as a data number and return if then JavaScript on the front end. This is what I’m watching: Build a Buzzfeed style quiz in Webflow with Ben Parker | AATT #61 - YouTube