<p>Assuming <code>yourLightSwitchFieldHandle</code> is labeled "Hide From Logged Out Users", something like this should work.  Completely untested.</p>

<pre><code>{# if the user is logged in OR they are not logged in but we don't want to hide the current product #}

{% if currentUser OR (not currentUser and not yourProduct.yourLightSwitchFieldHandle) %}
        Show Product
{% endif %}
</code></pre>

CC BY-SA 3.0
2016-07-20T22:36:34.117Z
Im not sure if it is labeled "Hide From Logged Out Users" how can I check?
JustinTheeDude
CC BY-SA 3.0
2016-07-20T22:38:34.297Z
It's just an example... the light switch can be either positive (Show to logged out users) or negative (Hide from logged out users) depending on how you've set things up. If it's negative, you need the `not` in front of `yourProduct.yourLightSwitchFieldHandle`. If it's positive, you don't.
Brad Bell
CC BY-SA 3.0
2016-07-20T22:39:56.147Z
Oh okay for sure I'll give it a try
JustinTheeDude
CC BY-SA 3.0
2016-07-20T23:36:44.497Z
Could I actually make a whole category private?
JustinTheeDude
CC BY-SA 3.0
2016-07-20T22:19:53.640Z
2016-07-20T22:19:53.640Z
Brad Bell
<p>Currently I have a light switch on some commerce items that make them private to users that are not logged in but they still show up when the user is logged out. Is there a way to do this? I'm continuing development for a webpage and I'm still new to craft so I am sort of lost</p>

<plugin-craftcommerce>
Creating private items
# Creating private items

(Asked by: username_0 on 2016-07-20)

Currently I have a light switch on some commerce items that make them private to users that are not logged in but they still show up when the user is logged out. Is there a way to do this? I'm continuing development for a webpage and I'm still new to craft so I am sort of lost

**Tags:** plugin-craftcommerce

---

## 1 answers

### Answer by username_1 on 2016-07-20. Score: 4

Assuming yourLightSwitchFieldHandle is labeled "Hide From Logged Out Users", something like this should work.  Completely untested.
{# if the user is logged in OR they are not logged in but we don't want to hide the current product #}

{% if currentUser OR (not currentUser and not yourProduct.yourLightSwitchFieldHandle) %}
        Show Product
{% endif %}

> **Comments:**
> **username_0**: Im not sure if it is labeled "Hide From Logged Out Users" how can I check?  
> **username_1**: It's just an example... the light switch can be either positive (Show to logged out users) or negative (Hide from logged out users) depending on how you've set things up. If it's negative, you need the `not` in front of `yourProduct.yourLightSwitchFieldHandle`. If it's positive, you don't.  
> **username_0**: Oh okay for sure I'll give it a try  
> **username_0**: Could I actually make a whole category private?  

---

