How can I create a special link with a discount popup?

kiwi8
Shopify Partner
13 0 2

Hi. I want to create a special link. 

mybusiness.com/speciallink10

if user clicks on it, he lands at the homepage with a special popup "Here is 10% discount #SPRING10"

 

is this possible? with an app or smth?

Reply 1 (1)

tobebuilds
Shopify Partner
268 13 75

Hi Kiwi8,

 

You can probably use an app for this, but the simplest way might be adding some code to your theme.

 

You can add this snippet to your homepage Liquid template:

 

{% if request.path == '/speciallink10' %}
<script>
// `document.addEventListener('DOMContentLoaded', ...) tells the browser to do something after the page has finished loading.
document.addEventListener('DOMContentLoaded', function() {
  // The simplest way to display a message is with `alert`, but there are better ways if you know HTML.
  alert('Here is 10% discount #SPRING10');
});
</script>
{% endif %}

 

That being said, you will probably also have to set up your site to display the homepage template when the URL path is '/speciallink10'.

 

Best,

Tobe