Filter text content by Product ID

Hi. So I have a Wix store and on the Product page, I want to have a Text element that can change its content depending on which product is shown.

so this text element is connected to the dataset. and this dataset has reference field in it whic has all product references.

what I am trying to do is create a little code, which will filter dataset content by product id. so when product 1 is shown text element will show content for when product 2 Is shown it will show content from product 2.

I know this can be done with dynamic pages but I need this text element to be on the product page.

Product:
I’m working in Wix Studio.

I tried Chat gpt but it does not understand how Wix works sometimes. I am not good at coding.

If you’re using code anyway you don’t really need the dataset. On the Product Page you can use

$w(“#productPage1”).getProduct().then((productItem)=>{
console.log(productItem) //prints the product item
})

Or you could use productItem to get the _id to sort the dataset

Thank you, Simen. Could you please tell me what it is? I can’t really understand what this code does and how can I use it.