 Welcome back to the channel. In this previous video that you have here on your screen, I was able to show you how to make a custom shipping method, which you can use on the front end of your Wukamas website, to allow you to have a different shipping method altogether. Now I put that code on GitHub right here, and you're able to pick it even in the very video description that you are watching. So what I'm going to do is go and copy that code. I'll copy all that code, and I'm going to go inside my plugins. I'll go in the wp content, go to plugins, and I'm going to create a new folder that I'll call TechiePress DHL Shipping. And inside that folder is where I'm going to create my TechiePress DHL Shipping.php. And this file is where I'm going to put all my code for my shipping method, save it, and then we shall be able to use it on our front end. So I'll come back to my dashboard, go inside install plugins. I'll activate this. I'll go to the Wukamas settings. I'll go to shipping. And you'll see that we have this new shipping method, which is TechiePress DHL Shipping. I'll click save to activate it. Then I'll go to my store into a new tab. And in our store we'll be able to shop a couple of items. And when I click to view cards, I'll be able to go through the normal shopping experience, click checkout. And then when we come here, you will see that we have this TechiePress DHL Shipping at 10.99. So what I want to do is I want to make sure that this shipping method is only available when I go to the district of Kampala. For the other districts, this should not be available. So I need to go back to my plugin section. I'm going to create a new folder, which I'm going to call a disable TechiePress DHL Shipping. I'll hit enter to create that folder. And then I'll create a new file with the same name. And I'll just add on the PHP file extension. And then of course I'll start off the PHP here. I'll use a start plugin snippet that I have to help me make that easy. And then I'll start by adding here a disable TechiePress DHL Shipping as a name. I'll add my plugin link for the author. And I'll just add that to the GitHub repo that I've created. And then after doing that, I'll just add my name TechiePress. And then of course give a license of GPO2 or later. And I'll just say this plugin allows for DHL Shipping method on Kampala State alone. So I'll save this and then I'll come here change the prefix or the text domain and then we're good to start the plugin. So I'll start off by adding basic security to this. And just say if the app's path is defined, then we are good to go. And if that's not defined, then we shall hit die in our PHP and say unauthorized access. So now that our basic security is done, the next thing we need to do is we're going to start looking for this particular field. Now one of the things you realize about Wukamas is that whenever something changes, let's say whenever we change the country, we get a refresh, we trigger an update of this cut. So I want to be able to trigger an update whenever we choose the district of Kampala. And the way this is triggered, we trigger this update of the cut by adding one CSS style to our style of any of these particular inputs that we do have. And that simple class that we add to any of these items is actually called update totals on change. So what I'm looking at doing is just adding this CSS class right here. Update totals on change. So that's what I'm looking for. So that when I actually hit this, we'll get that little trigger that you're seeing right now. Of course, this is not the way we add it in here. We need to use our Wukamas to be able to do that. In here, I'm going to use an action. So I'll add action. And the filter hook that I'm looking for is actually called Wukamas. Package rates. And after adding that hook, I'll add my own function that I'm going to use. I'll call it takey press change DHL. We'll use the priority of 100 and we'll be passing two arguments to that function. So I'm going to use the function takey press takey press change DHL. And inside this, we're going to use two particular arguments and that's rates and package. We get that on default by using this particular hook. So in here is where we're going to write our code. The first thing that I'm going to do is actually return the rates. That will avoid us having any errors. And the next thing that I'm going to do is I'm going to look for the customer data. And that will be in a variable that I am creating. And the way we get this customer data, we're going to tap the Wukamas instance. And in this instance of this class, we are going to look for the session. After tapping the session, we shall be able to use the get method on that. And what we are looking to get is just the customer. After getting the customer data, we want to get the billing state of the customer. So we're going to have this and we're going to say, let's tap the customer data. And what we want to tap on that variable is we want to get that the state. So I'll add a semicolon here after getting the billing state. We're now going to use an if function and say, if we actually have that state, if the billing state that is chosen is actually going to equal two. So I'll use two equal signs here and I will use Kampala. Now the way we get this state ID is by just going to our Wukamas. So I'm going to go in Wukamas here, go to I18N and then I'm going to look at the states. And the state that I'm looking for is Kampala. And you will see that it has this code UG102. So I'll copy this, come back here and paste it. So we're saying if it is Kampala. Now instead of Kampala, we want it to be available only on Kampala. So we're going to say not equal to Kampala. So if it's any other district, then what we're going to do is unset. And what we're going to unset is the rates. And in the rates we are going to pass in the ID of our shipping method. Now we need to go and visit this here and see what did we name this global for this method. So I'll copy this ID and then I'm going to pass it in here as this. So that's the first thing. So in other words, we are going to be unsetting this particular shipping item. Now in order to add a class to our state right here, we need to add also another hook to be able to do that. And I'll come back to my code and we're going to use one simple hook to do that. And that's from Wukamas and it's called the Wukamas checkout fields. And in here we are going to add our function and I'll say take a press add class. We need to have a better naming of this so that it doesn't class add DHL class. And what we shall do is just copy this function name and I'll say function give the name and then we shall start off our function writing it here. Now we need to get the fields variable that is coming in from Wukamas and after getting this field we'll need to return it. So we return the fields right now so that we don't break anything. So here we shall get the fields first and foremost and the fields we are looking for are the ones with the billing and then we are going to look for the billing state. After getting the billing state we are going to say now we need to add a class to that so we'll have a class and on that class we shall add two mt brackets and we shall say the class array that we are going to add onto what's already existing. We're going to add one style which is update totals on change. Of course add this semicolon at the end to close that off. And what we are basically telling our Wukamas or our site is that on reload here you're going to see that now when we change to Kaliro here you will see that we don't have that shipping address showing up here and when we change to Kampala we get that little reload that brings the shipping method right here. I'm going to just go back to my page and what I'm going to do is remove this and say if it equals to Kampala then we remove that shipping so after saving this I'm going to go back to the admin area of my website. I'll go to Wukamas right here and go to the settings and then I'll go to the shipping right here and all I need to do is go to take a press DHL shipping I'll click to save the changes so that that updates in my database and when I come here and reload what we have here you'll see that when I'm in a beam district we have this but if I change this to Kampala and hit it you'll see that we don't have that shipping option available if we change to Kaliro you'll see that we have this available so that's one way for you to disable a shipping method especially in your website when you've created custom methods or even using the methods that are local to Wukamas itself so if you enjoyed the video give us a thumbs up don't forget to subscribe if you're new to the channel and share it with your friends let them know that there are some good things that are here otherwise thank you for checking the channel and enjoy yourself