hello everyone and welcome to this week,video I hope business is doing good as,usual this week we'll see how to create,a Members Only store for your website,meaning that you want to restrict access,to any page on on your website but we'll,see also how to target specific pages,like the your your collection page your,product page or whatever page you want,to to target and force visitors to log,in or create an account if they they're,not already a member on your store so,this is what it will look like if you,see I'm trying to access another page on,my website it always brings me back to,the login so wherever you want your,trying to go it will always bring you,back to the login page and this this is,what we'll be showing in this video so,here's what the same page looks without,restricting access as we saw earlier and,also I just want to point out for you to,restrict access to your website you need,to have a good reason and you shouldn't,do this on any store I will so maybe,you're dealing with distributors or,maybe a specific group of businesses or,people that you absolutely need them to,have an account or maybe you need to,double check their information make sure,they're that they're professional or,they're they're part of a certain group,that being said let's see how how we can,we can do it please go in your in your,admin panel go in settings and check out,we need to make sure that customers they,need to have,an account so the really important,accounts should not be disabled should,be required or at least optional in my,case I keep it optional because I'm,gonna I'm not gonna always have that the,restriction on on my website so once,that it's it's set we'll need to modify,the team liquid page of of your store so,go back here in online store themes,click on the three dots and edit HTML,CSS on the left side here under layout,look for theme that liquid so basically,this is the main template the main,layout for your whole store and in this,first scenario we're gonna target the,the complete website so any page they,want to access they will need to log in,first so you'll see in the description a,link to where to get the code that we,need to to add right here let me just go,copy/paste it so here's the code that,you'll need to insert in your team,liquid page you need to see it in two,different sections you have the section,up top here and you will have the second,section which is the code that is,already on your your page so let me just,remove this so your your page here has a,ready code this will be we will keep all,of this and just add to it so we're not,modifying anything we're not changing,anything we're just adding to it so take,the first section of the code,up until else and we're just gonna paste,it over here so the else should should,end where the doctype starts or the,beginning beginning of your initial code,that you had there and we'll be missing,at the end if because we have we started,an if and we have an else and we need to,close the end if you don't really need,to know all of that just copy it and,paste it at the bottom of your page here,don't forget to save and now if we go,back to to our page that we had and we,refresh it's gonna ask you it's gonna,redirect you to the to the login page so,that's that fairly easy you can see now,that I am logged in and the page shows,us it should and their pages as well,home page let's just assume you will,like true to block access just on the,product page so for whatever reason you,don't want your products to show to,customers to visitors that don't have an,account yet in that case what I suggest,you to do is go to any product page in,this case I have this one just do a,right click on the page and do inspect,element I'm using Firefox you can do the,same in Chrome just do inspect element,and what I want you to do is scroll at,the top top and look for the line body,you have your body ID look at the far,right you're looking for something that,starts with template here we have,template product I can bleed template,page template collection and all of,those with target in this case template,product targets all products,that have the the template product,incoming so we're just gonna copy this,actually the important part is is what,follows the the template so in this case,it's its product so we can actually just,copy product we go back into the code we,just have to modify it a little bit so,it only targets that the template the,template product so we have to go here,in the unless we have the first if if,the template contains customer so this,is in the case that you are you are,already logged in you will have the,template we have a customer tag added to,it so the first if we're gonna leave it,as it is we're gonna modify the else and,we actually gonna make it an else if and,we will lose the same we will use the,same logic as what we have over here I'm,I'm gonna copy it but make sure you you,don't forget you copy that at the,product before so copy paste over here,and what we wanted to do is assign true,that I need you the code to send me to,login let's go to Lou to login,only when the template contains product,so let's save it let's log out,okay let's try to go back to the product,and it doesn't let me so this is perfect,another product it won't let me,but everything else works so that that's,good if you want to do the same thing,with with collection for example I don't,have collection on on this website but,let's still access it here so it will be,the same the same logic let's assume I,have this closed right click inspect,element God,go out the top look for the line body,and as some of you may guessed it the,template in this case it's collection so,we can do we can do exactly the same,thing we can add another one or let's,try to add an or,okay so this should work let's just,click Save refresh,perfect so now collection also it it's,gonna redirect to the login page,I hope this this was helpful and and,fairly easy to do if you have any,questions don't hesitate please ask as,usual in the comments below in the,description also you have all my,information my email Skype Instagram,LinkedIn whatever you need to get in,touch with me please do so and also,don't forget to subscribe I'm releasing,videos like this one each week so like,this you you won't miss any of them,thank you and have a good day
Congratulation! You bave finally finished reading how to assign members only shopify and believe you bave enougb understending how to assign members only shopify
Come on and read the rest of the article!