How do i access the wid of the Wishlist Products ?

Hello !
I added a button on every product of the page so the customer can add to his wishlist or remove the product from it.
I had no problem with the 'add' functionality but the delete one is different. It doesn't use the same id and i can't find a way to get this new one.
I thinks it's using a 'wid' wich is only reachable on the wishlist page but i need it on the category page.
So my question is, how can i get this 'wid' where i need it ?
Thanks in advance and have a nice day !
Best Answer
-
Joey Administrator, Moderator, Lightspeed Staff Posts: 277 moderator
To add products the product/ variant ID is used but removing it uses the wishlist-ID. After a quick look at the theme editor variables and URL's I, unfortunately, do not see a way to retrieve the
wid
from the collection (or product) pages.eCom Support TeamLightspeed HQ
Answers
I added a button on every product of the page so the customer can add to his wishlist or remove the product from it.
I had no problem with the 'add' functionality but the delete one is different. It doesn't use the same id and i can't find a way to get this new one.
I thinks it's using a 'wid' wich is only reachable on the wishlist page but i need it on the category page.
So my question is, how can i get this 'wid' where i need it ?
ok ! thank you for your answer ! i find another way to do what i wanted !
Hey,
Just curious, how did you manage to retrieve the Wid in the end?
We're trying something similar,
Best,
Hey,
the only way i find to retrieve those 'wid' is to use an httpRequest in JS so i can take all the items that are in the wishlist and use them.
I really don't think this is an optimize solution but Lightspeed never respond to me when i wanted to be a 'partner' and the wids are not free access soo...
Hope this helps ! Feel free to ask more questions if you want to do like i did !
Just as a follow up, since I had to do the same thing, here's a code sample of how you can get the wishlist using Javascript:
const result = await fetch('/account/wishlist/?format=json')
const data = await result.json()
console.log(data.wishlist)