wixLocation does not load custom code added through Settings

I have a custom code in Settings for Javascript which loads when I directly load a Product Page but when I navigate to Product Page through Repeaters it doesnt load the custom code. How can this be handled? I’m using “wixLocation.to” inside in my Repeaters.