Hide floating launchpoint on certain pages.

Created by Amanchi Madhav, Modified on Fri, 10 Nov, 2023 at 7:10 PM by Amanchi Madhav

We all know that our floating launch point is fixed and it appears on all the pages. It is a common use case that the merchants might want to hide the button just for some specific pages. Follow these simple steps and you should be able to do it.

Case - 1:
The merchant wants the floating point icon blocked on just one page.

Steps:

1. Go to the page the merchant is referring to, open the console and hit the following command:

window.location.pathname


And you'll get a response like this:

Copy this pathname

2. Create a snippet file swym-launchpoint-block.liquid(any name would work):

Add the following code to the file:

<script defer>
  function swymCallbackFn(swat) {
    setTimeout(toggleLaunchPointContainer, 0);
    function toggleLaunchPointContainer() {
      const launchPointContainer = document.getElementById('notepad-anchor-title');
      if (window.location.pathname === '*pathname you copied*' ) 
     {
        launchPointContainer.style.display = 'none';
      } else {
       launchPointContainer.style.display = 'block';
      }
    }
  }

  if (!window.SwymCallbacks) {
    window.SwymCallbacks = [];
  }

  window.SwymCallbacks.push(swymCallbackFn);
</script>

3. Add the following line of code above the body tag in the theme.liquid:

{% include swym-launchpoint-block %}

This will hide the launchpoint in that specific page.

Case-2:

The merchant wants the floating point icon blocked on more than one page.

Steps:

The steps we follow are almost the same with some minor changes.

1. When you hit the console command and get the pathname, get the pathname of all the pages you want to block the launchpoint in.

2. Create a snippet file swym-launchpoint-block.liquid(any name would work):

<script defer>
  function swymCallbackFn(swat) {
    setTimeout(toggleLaunchPointContainer, 0);
    function toggleLaunchPointContainer() {
      const launchPointContainer = document.getElementById('notepad-anchor-title');
      if (window.location.pathname === 'p1'  || window.location.pathname === 'p2' || window.location.pathname === 'p3') 
     {
        launchPointContainer.style.display = 'none';
      } else {
       launchPointContainer.style.display = 'block';
      }
    }
  }

  if (!window.SwymCallbacks) {
    window.SwymCallbacks = [];
  }

  window.SwymCallbacks.push(swymCallbackFn);
</script>

p1-pathname of page1 (copied from console)
p2-pathname of page2 (copied from console)
p3-pathname of page3 (copied from console)

3. Add the following line of code above the body tag in the theme.liquid:

{% include swym-launchpoint-block %}

This will hide the launchpoint in all that specific pages.






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