# Hide/Show Price if User is Logged In

**URL:** <https://forum.wixstudio.com/t/hide-show-price-if-user-is-logged-in/34610>\
**Category:** Ask the community\
**Tags:** wix-members-area, wix-stores, question, code\
**Created:** [June 23, 2018, 10:22am UTC](https://forum.wixstudio.com/t/hide-show-price-if-user-is-logged-in/34610 "2018-06-23T10:22:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eliana-fadida](https://avatars.discourse-cdn.com/v4/letter/e/f14d63/32.png) [@eliana-fadida](https://forum.wixstudio.com/u/eliana-fadida)\
**Post date:** [June 23, 2018, 10:22am UTC](https://forum.wixstudio.com/t/hide-show-price-if-user-is-logged-in/34610/1 "2018-06-23T10:22:31Z")

</div>

Hello, I know that Wix Store is now working with wix code. I am hoping to change the visibility of my store’s prices using wix code. Previously my store was set to hide prices on the products gallery and only a member could access the store product pages to view the prices and make purchases. The problem with this is I had to turn off the products quick view because the price was visible there without being logged in. I would also like the prices to be visible on the product galleries to members that are logged in and not only visible on the product pages.

I started the code as follows but I’m really unsure of how to code the price to show or hide:

import wixUsers from ‘wix-users’;  
import wixStores from ‘wix-stores-backend’;

$w.onReady(() =\> {  
if (wixUsers.currentUser.loggedIn) { (From below\*\*\*\*\*\*\*\*\*\* I know it is wrong)  
wixStores.price.show(“price”);  
} else {  
wiStores.price.hide(“price”);  
}  
} );

Any advice on how to correct the code to show/hide price in the product galleries based on a member being logged in or not would be much appreciated. Also should I add this code to each individual store page that is displaying a collection or should I add it once to the site? Thank you!

---

<div class="post-metadata">

**Author:** ![pgold\_09](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pgold\_09](https://forum.wixstudio.com/u/pgold_09)\
**Post date:** [March 1, 2019, 6:09pm UTC](https://forum.wixstudio.com/t/hide-show-price-if-user-is-logged-in/34610/2 "2019-03-01T18:09:29Z")

</div>

Hi did you manage to find out the code for this?

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [March 1, 2019, 8:33pm UTC](https://forum.wixstudio.com/t/hide-show-price-if-user-is-logged-in/34610/3 "2019-03-01T20:33:20Z")

</div>

Choose to hide on load the elements with the prices.  
Create a condition that checks if a user is logged in then show the prices.

For more information:  
[https://www.wix.com/code/home/example/Hide-and-Show-Elements](https://www.wix.com/code/home/example/Hide-and-Show-Elements)  
[https://www.wix.com/code/reference/wix-users.html#currentUser](https://www.wix.com/code/reference/wix-users.html#currentUser)

> **[Velo: Wix Stores "Products" Collection Fields | Help Center | Wix.com](https://support.wix.com/en/article/velo-wix-stores-products-collection-fields)**
>
> Tip:Before continuing, make sure you've read Working with Wix App Collections.To use the Products collection in code, refer to it as "Stores/Products"

Oh and by the way, you are missing a ‘x’ on this line: ‘wiStores.price.hide(“price”);’

Although it should really be something like this:  
$w(‘#price’).hide(); or $w(‘#price’).show();

---

<div class="post-metadata">

**Author:** ![pgold\_09](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pgold\_09](https://forum.wixstudio.com/u/pgold_09)\
**Post date:** [March 1, 2019, 11:18pm UTC](https://forum.wixstudio.com/t/hide-show-price-if-user-is-logged-in/34610/4 "2019-03-01T23:18:52Z")

</div>

the other problem s it doesn’t see the price as a element so (’ [#price](https://www.wix.com/code/home/forum/search/posts%3Fquery=.num.rice) ') is not recognized

---

<div class="post-metadata">

**Author:** ![kottravaipaalai](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/kottravaipaalai/32/23761_2.png) [@kottravaipaalai](https://forum.wixstudio.com/u/kottravaipaalai)\
**Post date:** [October 18, 2021, 10:01am UTC](https://forum.wixstudio.com/t/hide-show-price-if-user-is-logged-in/34610/5 "2021-10-18T10:01:04Z")

</div>

Any Solutions Guys ?
