Hiding part of the main menu unless logged in

I need to hide a portion of the main menu - in our case it would be “WHOLESALE” in the main menu so that it would not be visible to anyone who is not logged in.

We use LOCKSMITH and I have placed locks on our collections and products with the following permissions: “tagged with retailer” and “signed in”.

We have “Hide any links to this collection and it’s products … in your shop’s navigation menus” enabled.

The collections and products are hidden but the “WHOLESALE” section remains visible in the menu whether you’re logged in or not.

Anyone had this problem or solution?

@RKJ

sorry for this issue can you please try this similar way

{% if customer.tags contains "wholesale" %}
//wholesale  code to items.
{% else %}
//normal code to items.
{% endif %}
{% for link in linklists[menu].links %}
//code to items.
{% endfor %}

Just an if condition in your menu.

this works for me

{% if customer %}
Your menu
{% endif %}

this will not show the menu link until the customer was logged in.

I have a similar issue. There is one item from the main menu that I wish to show only if the customer is logged in, otherwise, I want to show the rest of the menu to non logged in customers also. The item I want to hide from non logged in customers is ‘Services’. I am using Dawn theme.

1 Like

Hi @KetanKumar - I’m trying to do this as well but I’m having a really hard time trying to identify where I need to include this in the code. Are you able to help?

1 Like

@Wlaney oh sorry for that issue can you please share your store url so i will check and update you.

Thank you!

Here is my store URL: https://v6rnxv-wk.myshopify.com/

I want to hide the DRS Distributors menu item for all customer unless I tag them with drs-distributor

Hi @KetanKumar - Any chance you’ve had time to take a look? Any help will be greatly appreciated.

1 Like

@Wlaney yes its can be done some custom code

Is that code something you can help with? @KetanKumar

1 Like

@Wlaney yes something like this code

{% if customer.tags contains "drs-distributor" %}
//drs-distributor code to items.
{% else %}
//normal code to items.
{% endif %}
{% for link in linklists[menu].links %}
//code to items.
{% endfor %}

@KetanKumar - Where specifically do I add the code though? That’s the issue i’m having. I’m not sure were to add it

1 Like

The answer is with Locksmith not code. I had this problem and solved it with inverting the locks.

Unfortunately I’m busy for the next few weeks, but when I get a break, I will look up the

solution. Hang tight.

@Wlaney oh sorry if you are not able to code customization can you please add me staff account so i can easy to manage code and update this

@KetanKumar - I don’t have the plan that will allow me to add more staff. Are you able to send a collaborator request to my store?

1 Like

@Wlaney yes sure i will can you please share your proper store url