Hi there,
I’d like to hide footer links from those who are not logged in. Is there a way to make them only visible to logged in users?
Here is the site: https://wholesale.harrisvilledesigns.com/
Hi there,
I’d like to hide footer links from those who are not logged in. Is there a way to make them only visible to logged in users?
Here is the site: https://wholesale.harrisvilledesigns.com/
This is definitely doable. The conditional logic can be a little tricky to get your head around—especially since liquid doesn’t provide much conrol over order of operations with and/or in if statements.
Here’s some potential speudo code showing how you might do it. This has not been tested so I am not 100% sure if it’s exactly right but hopefully it points you in the right direction.
{%- for link in menu.links -%}
{%- liquid
assign show_link = true
if link.handle == 'x' or link.handle == 'y' or link.handle == 'z'
unless customer
assign show_link = false
endunless
endif
-%}
{%- if show_link -%}
<li>…</li>
{%- endif -%}
{%- endfor -}
You could also tighten it up to be like this but it’s a little harder to understand the code:
…
if customer == false and link.handle == 'x' or link.handle == 'y' or link.handle == 'z'
assign show_link = false
endif
…