Streaming live at 10am (PST)

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: