Wishlist code on Category Repeater

Hi Everyone,

I am attempting to add an “Add to Wishlist” function on a dynamic page that has a category repeater. I want to add it inside the repeater so that each item displayed has a button that you can click to add that item to your wishlist. Below is the code I am attempting to use, however I believe I am running into two issues. The button functions sort of when clicked, it will add a row to the wishlist dataset, but it doesn’t seem to get the actual item ID to add that specific repeater item to the wishlist. I’m guessing that it because their are multiple items on the page and I need to somehow code the button to read only the item it is currently in. The second issue is probably tied to the first, but when I click the button, the button hides for all items on the page. I have it setup to hide when clicked, but I only want to hide it on that specific repeater item. Thanks in advance for any help you can provide.

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;

$w.onReady( () => {
if (wixUsers.currentUser.loggedIn) {
$w(“#addtowishlist”).label = “Add to Wishlist”;
else {
$w(“#addtowishlist”).label = “Sign in to Save”;
} );

export function addtowishlist_onclick() {
{wishlist_item: $w(‘#dynamicDataset’).getCurrentItem()._id}),