Pull additionalInfoSections from Products collection and show the info for each product in repeater

I have a repeater that pulls the data (Image, title and description) from the Stores/Products collection.
I’d like to have text elements within each repeated item that displays three of the info sections I have for each product, but I just can’t seem to figure out how to get access to the additionalInfoSections in the Products collection.

The info sections are for displaying the genre, the tempo and the tag of the product. (I sell music instrumentals).

I have made it work with a button with an onClick event, which logs all the descriptions for the additional sections, but I want to seperate them and show them individually with text elements.

// This snippet is a part of 'export function audioRepeater_itemReady($item, itemData, index)'
// #dataset3 is the Products collection

   let product = $item('#dataset3').getCurrentItem()
let ArrayAdditionaInfo = []
    ArrayAdditionaInfo = product.additionalInfoSections
    ArrayAdditionaInfo.forEach((element) => {
         if ($item('#consoleBtn').onClick) {
            console.log(element.description)
        }
    })

Any help is much appreciated.
I’m still learning both Javascript and Wix Code, so bear with me and my confused questions.

I figured it out myself.

I hadn’t really tried to use if statements because I was naive.

To anyone who might want to do something like this in the future, here’s what you can do if you have a repeater in which you want to split the additionalInfoSections onto different text elements.

  1. Get access to the additionalInfoSections from the Stores/Products collection:
let product = $item('#dataset3').getCurrentItem(itemData._id)
let ArrayAdditionaInfo = []
    ArrayAdditionaInfo = product.additionalInfoSections
  1. Get the description from each additionalInfoSection if the Title = Value
ArrayAdditionaInfo.forEach((element) => {

// If title = 'Tempo', show the description for the info section 'Tempo'
if (element.title === 'Tempo') {
let bpmValue = element.description;
        $item('#bpmValue').html = bpmValue; 
        
        }
if (element.title === 'Genre') {
let genreValue = element.description;
        $item('#genre').html = genreValue;
    }
if (element.title === 'Tags') {
let tagsValue = element.description;
        $item('#tags').html = tagsValue;
    }
    });

It’s very important that you use .html when telling the text-element to show the results. If you use .text, the description will be shown with html tags.

I believe you can close this thread if you ever get to see this update mods. :grin: