hey scott austin here from jade puma in,this video i'm going to show you how to,grant access to certain people for,content on a page and that page should,be on a product a collection or a page,wherever you want,um,to only certain people right so you can,either consider restricting access to,everybody else or granting access to the,ones that are letting in,and let me show what that looks like in,action i'm gonna go into this wholesale,store that i'm working on onto the,account page,and i've actually got two pieces of,content on this page that are showing up,because,of information about my customer account,that i've logged in with so i'm logged,in with an account that is tagged as,wholesale therefore this wholesale,information shows up i'm also logged in,as someone who's tagged as admin and by,admin in this situation we mean store,staff right so then i see the store,staff admin functions content also,and let me show you you know it working,in action here so i'm going to go into,my customers folder there's only a few,of us because this is a brand new store,building out but i log into my all right,look at my customer record and the,shopify admin and you see i've got two,tags 30 and admin so if i just delete,this admin tag and save it,go back and if the server is caught up,with us here refresh the page yeah that,admin content is now gone right if i go,back into my customer record,and put admin back in,refresh the page,on the front end,and my admin content shows up again so,notice i didn't change any code there,right the code is already in place that,i'll show you how to put in place all,i'm doing is adding and removing tags,from different customers and it's adding,and removing the access to that content,based on their tags so let me show you,how the code works because it is fairly,simple and there are apps that can do,this type of stuff,i like to use liquid code when i can,instead of an app just to reduce,complexity and this is one of those,things that's it's a fairly easy liquid,edit,so i'm going to go back into the shopify,admin and we're going to go to online,store,and we're going to click on the actions,button and then edit code for the,current live theme,and here we're looking at the account,details page right it's it's template is,account so we're going to go into the,templates we're going to find customers,accounts,right here,and we see that everything in here is,all in one section called account,details so we're going down to our,section account details,now when i add little snippets of code,like this,i like to make them their own little,snippet so instead of embedding it,inside of this account details,liquid for the section,i actually make its own snippet so here,you can see the two snippets one is,render account dash wholesale,and the other is,somewhere in here we'll see render like,account admin or something,well there we go render admin functions,so those are two little snippets i made,to,contain all my code there's a few lines,only a few lines of code in them i made,them separate snippets,so it's easy to uh see where that,content is so let's open up those,snippets we want account wholesale,and we want admin functions and you'll,see they both contain very similar logic,of an if statement,to start them off with now one of them,the admin one has just one if statement,and that is if,customer.tags contains admin and we saw,before right my customer record was,tagged as admin and this is the one that,turned that admin content on and off,now the account wholesale one is a,little more complex because there's,multiple,wholesale tags that could be used to,show that wholesale content so here you,can see we've got,if customer tags contains 10,or customer.tags contains 20 or,on and on and on for all the different,tags we have you could also do this like,let's say,the messaging here this messaging is,very generic it doesn't say you know,what discount level i have but what we,could do if we wanted to show that there,we could have you know a nested set of,if-then statements like if customer.tags,contains 10,show this content else if customer.tags,contains 20,show this content so you could have a,different message per tag if you wanted,to by doing if and then else if,statements nested in inside of each,other and it's also good to note that,right now we're on the account details,page so,we already on the account details page,there's there's a log login is required,to be on this page so i can easily,just put an if customer.tags contains,admin statement in there if you're going,to put this on a separate page where,you're not sure if they're logged in or,not then you want to add a little bit of,code that looks like this,if customer,or and sorry not or and,customer.tags so this if customer,basically says are they logged in so if,you want to put this content on a page,where you're not sure if they're logged,in or not the first part of your if,statement is check to see if they're,logged in and then if they are logged in,make sure that their customer record has,the appropriate tags,so hopefully that makes sense,and i'm just going to delete that,because i don't need it on this account,page,so that's how you can get content to,show up on pages for certain users,hopefully that helps and in the uh blog,article that'll be next to this video,i'm going to include a little snippet of,code you can just copy and paste,the code that i was showing you so you,can easily add it to your store thanks,for watching
Congratulation! You bave finally finished reading how to lock shopify store and believe you bave enougb understending how to lock shopify store
Come on and read the rest of the article!