How to display text on product page, only in certain category

Question:
[I would like to display text on a product page. It should only appear on the product page of a specific category. How can I go about doing that?]

Product:
[Wix Studio Editor.]

What are you trying to achieve:
[Explain the details of what you are trying to achieve. The more details you provide, the easier it is to understand what you need.]

What have you already tried:
[Share resources, forum topics, articles, or tutorials you’ve already used to try and answer your question.]

Additional information:
[Include any other pertinent details or information that might be helpful for people to know when trying to answer your question.]

  1. Use $w('#productPage').getProduct() to retrieve the product’s ID
  2. wixData.queryReferenced to get the product’s collections as an array,
  3. Iterate over it to see if your required collection is present
  4. Show the text if collection is present using $w('#yourText').show() or .expand()
1 Like

@DeanAyalon answered correctly!, and as an addition, I would suggest using .expand() instead of .show() to remove unwanted white space in other product pages.