 We'll come back to the channel. In today's video, I'm going to show you how to add your own shipping method and also give it a pricing that will be added to the total of the cut before you actually go to payout. If you're interested in this, stick around for the video and let's jump into the code. In wukamas, we are presented with an option of us actually adding different shipping methods like the flat rate, we can have a free shipping, we can have loco shipping and we can actually tie these two different zones and different names. Now, how can I add another option for myself? Maybe I want to add uber so that someone can choose uber or someone can choose something like DHL, which will give them fast shipping or air shipping, which is different from what comes by default in wukamas. So in wukamas, we have loco pickup, we have free shipping and we have a flat rate shipping. So how would we add our own kind of shipping method? So let's jump into that. So inside my root folder in my word press, I'm going to go into the wp content folder and then I'll go into my plugins and I'm going to start up a new folder which I'll call it tiki press DHL shipping and I'll get the same name and start up another file which I'll call tiki press DHL and then after doing that, of course, I'll start editing this particular file. Now with this file, I need to start off with opening PHP, I'll open PHP and then I'll start off what's needed. I'll now add some comments here and I'll add a plugin name which I'll call it tiki press DHL shipping and then I'll give it a description, say tiki press DHL shipping plugin. So I'll hit seven this when I come to my plugins at reload, you will see that we have our DHL shipping right here. So I'm going to activate this and of course it does nothing but that will get us starting to write our particular code. So I'll close this page and then we'll just focus on having our shipping methods here and then writing code here. So the first thing that I'm going to do is add an action and this action is going to tap into a wukamas action which is called a wukamas underscore shipping underscore init and that's the hook that I'm looking for. Now the reason I'm doing all of this is because I want to type into the wukamas shipping method API and you can see that we are provided with this particular function that we can start with. Now I need to make some callback on my particular plugin so let me go into that and I'll open up a callback and I'll call this tiki press shipping init copy this add DHL then add that final piece and then I can start off my other function. So function we'll start working in here. Now what we're going to do in here is initiate our own class of the shipping method of wukamas. So the first thing we'll do is we'll check if this class actually does not exist. So if this class does not exist and the class we are looking for is going to be called so the class we shall be looking for is wc tiki press DHL shipping. It can be any name but this is what I've chosen to have. So if that class does not exist then we're going to actually run all this code down below. So then if it doesn't exist then we'll add our own class which we'll call that and it is going to extend the wc shipping method and that's all we need to do so I'll open up my class and then I'm going to start writing code inside that class. Now while we extend the wc shipping method right here and we are making our own class we need to instantiate this class and run it inside our wukamas. Now what we need to do after writing our class or extending this method we're going to add a filter and what this filter is going to do is add our newly created method and then add it into the existing methods of wukamas so we need to tap into the wukamas need to have that with double o so the wukamas shipping methods and the wukamas shipping method we're going to add the tiki press DHL method and that is going to be our new function so I'll copy this and then I'll start writing this function so every time we are writing a filter we know that we get something that can be passed inside our function and in this case it will be methods and the first thing that I do is return those methods now we can modify these methods without any thoughts coming into our heads. Of course now we are going to get our methods because it's an array we're going to have to add the ID of our method so I'd like to call it the tiki press DHL shipping and it will equal to the class of our method so we're going to copy this and then I'm going to add it here. Of course this class that we're extending comes with a number of methods but right now I'm going to use the init method I'm going to use the constructor so it will come first here I'll use the constructor I'll use the init and we'll have the calculate shipping method where we add the pricing of our particular shipping method. I need to add public function to this and add it to all these other methods and then I'll wrap this. Now of course in our constructor we'll need to pass in all our variables and this will look like this so we need to get this class that we've made and we're going to pass in an ID for this class so we decided that our ID should be tiki press DHL shipping so I'll pass this in and then for our title we shall call it the tiki press DHL shipping so I'm going to copy this here and then I'll add it for our name here description and say description of tiki press shipping we'll add it as enabled so we can either force it to be enabled by default or we can force it to be off and then we can also add the title of this particular class and this will be passed into our setting so once we do this we also initiate this particular function that will pass in all our settings so let me save this and in init method we're going to have to add these settings so first of all we shall have the wukamas init form fields which is part of the settings API so we can add our own form fields if we want to then we can also init the settings and then we shall have to save the settings of that particular form that we come up with in our class so let me save this and then I'm going to come back into the administration area go to our plugins I will deactivate this and then I'll reactivate it I'll come back and reload this and if I quickly come back and look at it this should be construct not constructor I'm mixing so many languages here so I'll come back reload this again and now you'll see that we have all these options coming in and we now have the teki press DHL shipping so when we come to it we'll see that we don't have any options yet here but we shall be able to add them now lastly we are going to set some calculations of the shipping price into our calculate shipping method now this particular method comes with a variable we have a variable which is called package and we need to pass it inside our calculate shipping method and then we're going to edit what we have here so we shall add in a rate and then after we shall use this method of wukamas which usually adds extra charges into our checkout page and what we're going to do is just add a cost of 1099 the label we shall have it as this title so that means it will go to the construct and look for the title so this will appear with this cost and then we can calculate the tax basing on each item and then we shall register this rate and would be good to go so let me save this and then I'm going to come to our checkout and refresh this here and now we are going to see that we have a shipping method that is actually here and this shipping method will add $10.99 and if we look at our total of our shipping where we had $1,000 as our subtotal if we add on the $10.99 we have $10.99 that's how we add an extra shipping method inside of our wukamas