# Store collection filter (from authorized users)

**URL:** <https://forum.wixstudio.com/t/store-collection-filter-from-authorized-users/15568>\
**Category:** Ask the community\
**Tags:** question, code, wix-stores\
**Created:** [March 27, 2019, 7:41am UTC](https://forum.wixstudio.com/t/store-collection-filter-from-authorized-users/15568 "2019-03-27T07:41:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eugene-m](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/eugene-m/32/824_2.png) [@eugene-m](https://forum.wixstudio.com/u/eugene-m)\
**Post date:** [March 27, 2019, 7:41am UTC](https://forum.wixstudio.com/t/store-collection-filter-from-authorized-users/15568/1 "2019-03-27T07:41:05Z")

</div>

Hi there,  
Could you help me with the following ↓

1. I have an online store that contains several collections. I would like to show goods from collections only to a specific users who have been authorized on the site.

2. I created a database collection “Clients” where I specified a condition

![](https://us1.discourse-cdn.com/wix/original/3X/4/1/41d52c4f47c266575662bc4ecd1287903a3c4387.jpeg)

1. I created a store page where I used two collections “datasetClients” and “datasetProducts”.

2. I used the following code

```javascript
import wixUsers from "wix-users";
import wixData from "wix-data";

$w.onReady(function () {
    wixUsers.currentUser.getEmail()
        .then( (email) => {
 let userEmail = email;
 let permissionEmail = $w("#datasetClients").getCurrentItem().password;
 // password field contains a valid email

 if (permissionEmail === userEmail) {       
 var collection = $w("#datasetClients").getCurrentItem().collection;
                $w("#datasetProducts").setFilter(wixData.filter()
                    .hasSome("collections.id", collection))
            } else {
                $w("#galleryProducts").collapse();
                $w("#columnStripMessage").expand(); // You are not authorized to view this category.
            }
    });

});

```

This code works … but the code works strangely. If I pass the authorization on the page with the goods, then after authorization on the site the gallery of goods displays all the goods of the store. Next, I refresh the page with the F5 (already authorized on the site) the product gallery displays the goods I need from the collection. If I logged in on the home page and then opened the store page, the filter works.

This is my first wixUsers experience. Any help would be helpful.
