any idea why I can't set a link to a button?

I have tried so many times, and I can’t understand why I can’t set the link to a button but can consol.log it correctly. I also did it on another page and this works well for me.
WHAT AM I DOING WRONG?
my code:


My btn + log:

You’re better use strict mode, i.e. === in the if conditional and not just double equation.
But that’s probably not the reason. What does it log to the console (it’s hard to read in your posted screenshot)

Also it loos like you repeater has more than 1 item, so it doesn’t meet the condition you set.

Hey J.D, thx for your reply : ]
my code is saying, if there is 1 item in repeater then set the button link to be a link from a collection, in my case: “userCart.urlService”.

on my first screenshot you can see that i print it and get the link correctly, (i did it to check if i get the right link and i did)

now i am trying to set this link to my button source link but the button isn’t redirecting to the link i have set in serviceLink.

:roll_eyes:

Either set the link in the $w.onReady block and remove the onClick handler or use the event handler with wixLocation.to(link) instead of setting a button link.

thx, i will try that