welcome back I'm feeling a little under,the weather so if my video today seems a,little bit Spacey,that's why but today we're good we're,gonna be doing is room I'm gonna be,replying to a comet that was left on one,of my videos about how to make a,collection private so that if only if a,customer is tagged with a specific tag,will to be able to see what's in that,collection so let's jump into it so,sometimes you want to create a,collection page that has password,protection on it so that if a customer,is tagged like VIP then they can view it,if they're not tagged then they would,not be able to view the products out on,the page this would be used in a,situation where you want to have people,sign up for a membership list and if,they are approved on the membership list,then they get access to products before,the rest of the community des or before,the rest of your customers do so what,I'm gonna do is I'm gonna go through and,I'm going to show you how to set this up,I'm going to have to create three,different pieces we're first gonna have,to create a collection that we are going,to be able to assign a template so that,the specific collection that we have,picked is going to be password protected,the second piece that we're going to do,is we're gonna set up a page that's,going to give some information if,they've received a no access item and,they need to be told where to go to get,access to it so we're gonna create that,and then the third thing that we're,gonna do is we're gonna create a little,bit of JavaScript to redirect them if,they've gotten to the page and we want,to make sure that they continue with,their user experience even if we don't,want to ever end up someone in a dead,end as it were so let's hop over to the,screen so we're on our demo store here,the first thing that we're going to go,and do is we're gonna go and create a,new collection so we need to have a,collection that we can work with so if,we go into products and we go to,collections we are going to go to create,a collection so let's go and create a,collection so the collection that we're,gonna have in here this is going to be,our private collection,okay and we are going to make this an,automatic collection and we are going to,tag it with let's say we are going to,tag it with Chanel only our Chanel,designers are going to be private and,then we're going to save it this gives,us a collection that we can now make so,that when people go to view private,collection they will be able to be the,only ones who are able to see this one,now before we move forward we're going,to need to create a new collection,template now this collection template,that we have is this is what's gonna,hold the code that's going to check to,see if the customer is tagged and,allowed to go into the collection so,let's go to our theme templates and go,and modify it there so if we come back,over to the store and we go to online,store and we go to themes we're gonna go,into our theme and we're going to go and,edit the code now what we want to do is,when we're on the templates page we're,gonna add a new template and we're gonna,create a new template and we're going to,call it collection and we're gonna call,this one private private - collection,okay I'm going to create this template,now this template basically takes the,existing collection template duplicates,the code over and creates a new template,so nothing has really changed yet but,what this allows us to do is if we head,back over to products and our,collections we can now assign this new,template to the collection that we just,created in order to have different code,render when this collection gets pulled,up so now if we have a look here under,our drop-down list we now have the,option for private collection so once,we've done that it's saved now we can go,and modify the code in the theme,template so that you're able to go and,may have it check to make sure that a,person has a tag whether they're out to,view it or not so let's go back over to,themes and go to edit code,and we're gonna pull up that private,collection that we've just created so,under the templates and we're gonna go,to private collection and we're gonna do,a couple of liquid code if statements so,the first thing we're gonna do is we're,gonna write if customer tags contains,VIP show the collection else we wanted,to show some content saying that they're,not able to do that and we're gonna do,that by pulling in a page that we have,created on our CMS so I'm going to show,you how to do that in a minute,but first we're gonna put the code in,here I'm going to call this page know -,access - content and then I'm going to,end the if ok so what this first piece,of code does here is if customer tags,contains VIP so what this is gonna look,is it first gonna look to see if the,customer is authenticated make sure that,they're actually logged in then it's,gonna go through the customers profile,and it's gonna check to see if it,contains VIP so if it does contain VIP,we wanted to show the collection if it,doesn't we wanted to show the page,content of the page that we've created,called no access and we're gonna pull,just a content in there and that's going,to end if so once we save that we are,now going to need to go over to pages,and we're gonna have to create that text,that is going to be displayed if we,don't have access so we're gonna go,pages and we're going to add a page and,we're gonna call this no access now the,page title is not super important,because this is not going to be a page,that's going to be shown anywhere else,other than just as a place for you to,hold the content the reason we're using,a page in this case is because it makes,it easier for us to edit in the future,so this is a private collection please,join our VIP member list,to view it okay some simple text in here,I'm gonna line it in the center and I'm,going to save it,alright so what have we set up now so,now if we go to our private collection,and we go into a demo store here I'm,gonna actually go over to products and,I'm gonna view that collection that we,just created in a private collection now,before I do that I just want to show you,that I am not logged in if I click on,the login sign it's going to ask me to,login so I'm gonna show you what happens,before we're authenticated so if we go,in and we view this private collection,it goes to check to see if we are,authenticated is obviously we're not and,then it comes up with the text that we,entered into the page the sir private,collection please join our VIP member,list to view it okay so now we're going,to authenticate so the next thing I'm,gonna do is I'm gonna go and I'm going,to login to the store now I have gone,and created a user account so I'm gonna,go into customers and I'm gonna go into,my user what I need to do is I need to,double check to make sure that this user,has the tag VIP currently it doesn't so,we're gonna go VIP and we're gonna add,that to the customer now if I go to the,account and I log in okay now I've,logged into the store and if I want to,go and view that collection again so,we're gonna go back over to collections,I'm gonna actually make this a little,easier what we're gonna do is we're,gonna add it to the online store in the,navigations so it's an easy click for us,to get to so we'll go to navigations and,we're gonna go to main menu we're going,to add in a menu in here and we're gonna,called VIP collection and we're gonna,set it to go to the collection that we,just created which it called private,collection add that in there,so now if we reload our page we have VIP,collection and we can go over to it now,that I'm one Fennec ated we can see I,can now see my private collection now if,we want to just double check that so,that if a customer is not tagged with,that VIP tag I'm gonna remove that tag,and hit save now if I reload this page,we can see we get the content that shows,up from that page that says this is our,private collection please join our VIP a,list of you so now we have the ability,to go in and maybe pad in MailChimp,email form that would sign people up,maybe we add a form in there that gets,sent to us so that we can go and approve,the people that have signed up for it we,can have a create and account button,added in there lots of options to do,there but that's basically how you go,and make a collection private so that if,someone wants to view it and they have,been approved by the system that they've,gone through the nationís Harry steps,then they're able to to view these store,thanks for coming by I hope this was,helpful if it was hit the like button if,they hit the subscribe button if you,want to get updates from me weekly leave,a comment down below if there's,something that you would like me to make,on a video and we will see you in the,next one
Congratulation! You bave finally finished reading shopify how to password protect store and believe you bave enougb understending shopify how to password protect store
Come on and read the rest of the article!