Liquid syntax error: Error in tag 'section' - Valid syntax: section '[type]'

tandjscents
Excursionist
13 0 6

Hi everyone,

 

Don't know if you can help. I am trying to create a collection where only my subscribed members can view. I don't want to download an app as they are paid. I have found this code:

 

{% if customer.tags contains ‘vip’ %}
{% section ‘collection’ %}
{% else %}
{{ pages.no-access.content }}
{% endif %}

 

but I keep getting this error when saving:

 

Liquid syntax error: Error in tag 'section' - Valid syntax: section '[type]'

 

Any ideas on how to fix this, I'm not a coder, so please be gentle on me 😄

 

Josh

Replies 11 (11)

tandjscents
Excursionist
13 0 6

Ignore the above, I have figured this out now. However, my tagged customers still cant view the page. Any ideas?

gwenp
Visitor
1 0 0

Can you share how you resolved this? I am having same issue.

okioki
Tourist
5 0 2

Hi Gwenp,

 

not sure if this is still relevant, but I had the same issue. For me it was a matter of swapping out the quotation marks from the code I had pasted in.

fashion7C
Visitor
1 0 0
Click to expand...
 

Hello, 

 

Wondering how you resolved this. I am experiencing the same issue. If you could please share that would be great. 

 

Thanks!

tandjscents
Excursionist
13 0 6
Apologies, I had someone edit the code on my store as I couldn't find the solution.

tandjscents
Excursionist
13 0 6

All solved.

 

had to change the commas.

 

 

Not applicable

Hi,

I'm trying to set up this exact same code. How did you solve it? Where are the commas that you changed?

L9OBL
Visitor
1 0 0

It wasnt commas, he's talking about the apostrophe's used in the code, you can see theyre kind of stylized, just replace them with regular apostrophes on the first and second line.

gnlweirdness
Visitor
3 0 1

so I am using this same code, it was working fine. i.e. showing the no access page to those without tags, only showing product for those with tags. 

But now for some reason it is showing both the no access page and the product to anyone with the collection page link.

ANY ideas?

dmwwebartisan
Shopify Partner
12282 2546 3694

Hey there,

 

Do you have collection.liquid in your sections folder ?

 

If not exists then please create new one OR check what section liquid file you would like to display with and name correct there.

 

Thanks!

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com |  Instagram: @dmw.webartisan
Check here PageFly App to customize your pages | #1 Product Filter & Search app on Shopify | The most powerful Shopify page builder app

emex
Shopify Partner
15 0 1

Was having same issue.

if you replace the code with this it will fix it:

 

{% if customer.tags contains 'vip' %}
{% section 'collection' %}
{% else %}
{{ pages['no-access'].content }}
{% endif %}