Re: How to modify the dynamically created Shopify site after Newsletter subscription

How to modify the dynamically created Shopify site after Newsletter subscription

Otayfer
Excursionist
40 0 10
Dear all,

 

I set up a 10% discount coupon for newsletter subscribers. 

Now I am wondering if somebody could show me how I can modify this page: https://otaro-shop.com/account/subscribe?email=elg72723%40zzrgg.com&token=-4fl89huPoxEiHmCG4wVEC-alL...

 

It seems like this page is generated dynamically for each Subscriber of our Newsletter. I would like to add a nice button to activate a coupon (10% discount after he successfully susbscribed) and some basic HTML.

 

I know that I can add some text via the "Language" option (how already done) but HTML or adding a button is not possible with this adjustment... 

 

Highly appreciate your help!

 

Best,

Adrian

Replies 31 (31)

tokant
Shopify Partner
20 0 10

Did you find a solution? I am also not able to finde the pages for email marketing (/account/subscribe etc.)

phil_CM
Explorer
85 1 11

Did you find a solution to this?

tokant
Shopify Partner
20 0 10

I haven’t tried it out but these pages (although dynamically created and controlled by Shopify) use the page template. So you can use a conditional in liquid, test if the visitor is on the capcha page and then show a custom section or other code.

phil_CM
Explorer
85 1 11
As in the page template for pages?
tokant
Shopify Partner
20 0 10

Sorry, I had to find the reference post. It is the theme.liquid file - not page.liquid.

{% if request.path == '/challenge' %}
{% render 'challenge' %}
{% else %}
{{ content_for_layout }}
{% endif %}

So in the theme.liquid file you can make a conditional for the request.path and then render a custom section.
However, in the case of the challenge page (the first step after the newsletter signup form has been submitted and captcha is enabled), the whole captcha validation might not be so easy. You'd need to do some research on the pitfalls and know exactly in which scenarios the challenge page is shown.

phil_CM
Explorer
85 1 11
The page I am on about is the subscription confirmation page. It’s a page displayed after the customer verify a their subscription in the email they are sent when double opt-in is enabled. Sounds like this method might still work?
tokant
Shopify Partner
20 0 10

Yes, in theme.liquid just check what the request.path is and you can replace {{ content_for_layout }} with anything you like:

request.path

  

phil_CM
Explorer
85 1 11

So I replaced

{{ content_for_layout }}

 

with

{% if request.path == '/account/subscribe' %}
{% render 'THIS IS A TEST' %}
{% else %}
{{ content_for_layout }}
{% endif %}

 

It replaced the content but with the following:

Liquid error: Could not find asset snippets/THIS IS A TEST.liquid

 

Do I need to create anothe file too?

phil_CM
Explorer
85 1 11

Or do I just do it like this:

{% if request.path == '/account/subscribe' %}
<h1>This is a test - MY HTML HERE</h1>
{% else %}
{{ content_for_layout }}
{% endif %}

 

tokant
Shopify Partner
20 0 10

This is another way of doing it. You are free to use snippets, sections or "direct" code (like the HTML in your last example).

phil_CM
Explorer
85 1 11

perfect I will try with snippets as this will be neater.

 

My only concern is if there are any other pages that are build from this path.

 

for example the content I see is account/subscibe?email=.... etc

 

but what if different content is genrated if there is a different query string used that I am not yet aware of.. I guess this will have to be trial and eror and LOTs of testing to make sure I havent replaced other content with a generic peice of content. does taht make sense?

tokant
Shopify Partner
20 0 10

Great!

Yes, as I mentioned before You'd need to do some research on the pitfalls and know exactly in which scenarios the page is shown.

Like you say, trial and error, testing, researching will map the scenarios, and you can then apply the appropriate functionality to each.

phil_CM
Explorer
85 1 11

the plu side the unsubscribe has its own page so it doesnt affect that one 🙂 that one is account/unsubscribe

phil_CM
Explorer
85 1 11

Thanks though, works a treat

A512D279-7FD7-4057-B3E4-B6DAA2447AFA.jpeg

IritaCi
Visitor
1 0 0

Hello, 

 

I'm facing with the same Issue what did you. I was wondering, did you manage to replace a Template as you wanted? 

I don't have much experience in the HTML, but I can do some basics, can you, please help me with the code, what need to be place in the   content_for_layout to have us you have now in the email. I will appreciate your help highly. 

IritaCi_0-1616526713302.png

 

 

Bestätige Deine Anmeldung

Bestätige Deine Anmeldung

Aufgrund der DSGVO brauchen wir eine Bestätigung von Dir, damit Du Deinen 10% Gutschein erhalten darfst.

Ja, ich möchte mich anmelden.

Wenn Du dich nicht für diesen Newsletter angemeldet hast oder nicht sicher bist, warum du diese E-Mail erhalten hast, musst Du diese E-Mail nicht weiter beachten. Du wirst nur zum Newsletter angemeldet, wenn Du auf den obigen Link klickst.

Falls Du Fragen hast, kannst Du auf diese E-Mail antworten. Adrian bei Adrian@otaro-shop.com.

phil_CM
Explorer
85 1 11

Create a snippet file with your HTML

then follow the instructions on what to do with the theme.liquid file a few posts back. Replace THIS IS A TEST with the name of the snippet file (without the .liquid)

andauser
Explorer
69 0 35

Hello,

 

Thank you for this helpful discussion. I am able to create my subscription page as instructed herein, however, I would like to display different languages when needed. My original store language is German, however, I also have an "English" option.

 

Could you help me with that?

Kind regards,

Ayse

andauser
Explorer
69 0 35

Hello again,

 

How do you get the correct unsubscription link x in your newly created snippet for the line:

<a href = "x">

 

Could you help me with that?

Kind regards,

Ayse

phil_CM
Explorer
85 1 11

Is there a problem with the link then? Or is it not displayed?

andauser
Explorer
69 0 35

I just wanted to put a unsubscribe link, but I could not find what is the correct http (source) for it.

 

Could you help me with that?

Kind regards,

Ayse

phil_CM
Explorer
85 1 11

I will look into it. I have just realised that there is an error In my link actually. If I haven’t got back to you in a week or so remind me!

Tarik-Fanarik
Shopify Partner
5 0 8

Hi @andauser ,

Completing @phil_CM ansver: 

 

 

 

{%- if request.path == '/account/subscribe' -%}
  {%- assign unsubscribe_url = content_for_layout | split: 'href="' | last | split: '">' | first -%}
{%- else -%}
  {{ content_for_layout }} 
{%- endif -%}

 

 

 

`unsubscribe_url` - it will be you url to unsubscribe.
phil_CM
Explorer
85 1 11

Thanks @Tarik-Fanarik  I will give this a go. I never got around to finding a solution for this.

jennifervdz
Shopify Partner
20 0 7

Hi! I have a custom confirmation page and I am trying to add at the bottom the unsubscribe link but I haven't been able to do it, do you know how to do it?

rockstar3000
Excursionist
26 2 11

At the end i did it like this:

 

Create a _account-subscribe.liquid and a _account-unsubscribe.liquid snippet.

 

From theme.liquid you need to pass the unsubscribe_url variable to the _account-subscribe.liquid snippet. Like in this code example:

 

{% if request.path == '/account/subscribe' %}
{%- assign unsubscribe_url = content_for_layout | split: 'href="' | last | split: '">' | first -%}
{% render '_account-subscribe', unsubscribe_url: unsubscribe_url %}
{% elsif request.path == '/account/unsubscribe' %}
{% render '_account-unsubscribe' %}
{% else %}
{{ content_for_layout }}
{% endif %}

 

 

Inside the _account-subscribe.liquid snippet then you can use it like:

 

<a href= {{ unsubscribe_url }} >Unsubscribe from this shit</a>

 

 

Of course you can name snippets and variables as you like. However if you copy/paste like in the example it will work right away.

 

Good luck! 🙂

Swaggerlikeme
Excursionist
46 0 1

Hi There were you able to implement this without any issues? are there any other  pages that are build from this path? 

thanks for sharing mate. This is a pain in the behind. Is there a way to trigger an email to send the discount code after confirming the subscription ?

phil_CM
Explorer
85 1 11

Hi Tarik, I finally got around to trying this. The URL is almost correct, only issue is that the url generated is

 

/account/subscribe?token=[TOKEN INSERTED]

 

but for it to work the url has to be 

/account/unsubscribe?token=[TOKEN INSERTED]

 

Is there a way to modify the above to use unsubscribe instead of subscribe?

Cooperman100
Excursionist
16 0 5

Hi Phil,

 

After coming across this same issue on the account/subscribe page, I found your solution on this forum when investigating solutions.  Really helpful.  Solved my issue on the desktop and tablet version of my site.  

 

HOWEVER, this does not work on the mobile version.   Just a blank screen comes up.

 

 

Is there some more code I can add to account for mobile visitors?

 

Thank you 🙂

tokant
Shopify Partner
20 0 10

Yes, {{ render }} refers to snippets.

Swaggerlikeme
Excursionist
46 0 1

Hello @phil_CM Were you ever able to implement this code after all was there any pitfalls or uses for this page ? Were you able to show the discount button on the landing page ? Where is that data coming from on the lading page it has to be hard coded somewhere no ?

coin
Tourist
4 0 3

Thanks a lot tokant. It was very helpful.