Wishlist Behind Login

Created by Vatsalya Pandey, Modified on Wed, 18 Sep at 10:49 PM by Vatsalya Pandey

Step 1 ) Go to script Manager inside the theme settings.


2) Add a file called ‘swym-behind-login’ and set up the script options. Set the script category as Funtional




3) Select script type as "Script"

 4) Now add the following script and save


<script>
function swymCallbackFn(swat) {
    let isLoggedIn = SwymPageContext.swym_custid ? true : false;
    const LOGIN_PAGE_URL = "/login.php";
    const swymRedirectToLoginPage = () => {
      window.location = window.origin + LOGIN_PAGE_URL
    };
    if (!isLoggedIn) {
      SwymUtils.getHostedURL = function() {
        /* Navigate to login page on click of swym-icons for wishlist page.*/
        return LOGIN_PAGE_URL;
      }
      //     Override launchpoints.
      swat.ui.open = swymRedirectToLoginPage
      // Override default API implementations. buttons,icons..etc
      swat.api.addToWishList = swymRedirectToLoginPage
      //     Override API for Pop-up
      swat.ui.uiRef.addToWishlist = swymRedirectToLoginPage
    }
}
if (!window.SwymCallbacks) {
    window.SwymCallbacks = [];
}
window.SwymCallbacks.push(swymCallbackFn);
</script>


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article