Streaming live at 10am (PST)

Referencing Collection Items

Hello,

I am wondering if there is a way to reference specific collection items. I am new to coding (an understatement) but I have found a way to console.log the image url’s from the below collection using a dynamic link to each product’s “Main Image”. What I would like to ultimately do is use the Collection Item itself as a button to run an onclick function and send that “Main Image” elsewhere.

I just can’t seem to figure out how to reference collection items specifically. All I can find upon “inspect” is w-dyn-item and this id is shared by all of the items in the list. Running js on it seems to break the code because variables are called multiple times.

If I push the code outside of the Collection Items however, I am not able to reference the specific products that are showing in the collection list with the dynamic options and therefore won’t be able to pull the images which is the whole point!

Let me know if anyone knows of a way to identify collection items individually and uniquely.

Thank you!

1 Like