 So tradicionally when we want to handle how much materials we are taking from mashup and how to restock we use the inbuilt inventory system of wukamas. However today I want to share something that can help you actually restrict how many orders that you should get in a day or how many orders that your business should be able to ship out. So I was looking online until I found Remy Kosun's plugin that he developed just about let's say two days ago and it's something that you can use right now with what's going on in the world. So assuming you have a small business with a very little manpower to carry out the the shipping of goods you can actually have something that will just allow you to take maybe let's say 10 orders and then you will have a message saying that you've exceeded your capacity to taking any new orders and basing on that you'll be able to have your customer still see your items of course without the pricing and the the cut buttons add to cut buttons but your shop will still be available and you don't have to worry about getting extra orders. So what we need to do is actually just come to this button here and download this particular plugin from this URL which is a github at Kosun R and then the next thing that we'll do is we'll add it in our in our plugins and activate. So we have it here restrict orders per day for wukamas and we need to activate it. After install when we come to our settings page in the general settings we actually have a maximum orders that we need to fill out so what I'm going to do I'm going to change this to two so that we can quickly process out our orders panel in our wukamas. I'm going to come back as a customer and go to the store and I'm going to just order a few things here and then I'll go view the cut skip the cut proceed to checkout fill in my details and then all I need to do is finally press the order so we have order one pressed and it's received so what we're going to do is we're going to attempt to do the same thing over again so we're going to go to the shop and make another order and then we are going to place our order and that order has been received so if we come back to our shop here we actually see that it's telling us we have exceeded our capacity so you can't order anything today so let me just go through that code to show you how we actually can be able to edit that so we'll not write the code but we'll just be able to see how that is spin up so I'll open up my editor we have the basic elements that are needed for plugin to start it's basically this plugin has been put in so that so that people can be able to use this quickly so of course we start off with the little protection to make sure that no one is hitting at this file directly from the browser and then the next thing we do is that this plugin is written in object oriented programming so there is a use of a class which is called our ROPD which is the short restrict orders per day so first check if this particular class exists and if it exists then we do nothing we just call for an instantiation of that same class however if it doesn't exist then we go ahead to we go ahead to declare so this function is the first one that runs in any given class and therefore in this function we are going to run three different kinds of our hooks we have an action hook that taps the plugins loaded action and in this one we add the text domain so that this particular plugin can actually be translated you will see as we go down here that it has translation marks that means we are able to translate it and use it in different languages the next action hook that we have is the wukamas general settings which is the one that has all those settings involved to bring us to this page when we come in our settings page so essentially we're going to be working on two of these fields so we're going to have a numbers field we're going to have a text field here that will allow us to do a number of things so first things first is we look at when we tap when we add this function to this filter which is wukamas general settings it passes us it gives us an argument which is settings that we are able to see so what i'm going to do here is i'm going to just try to overdamp these settings and we can see what we have in there so after overdamping i'll just add die to allow us to see what goes on so i'll come to the backend reload and we'll see that we have quite a lot of information that's passed in here a lot of options so in here i'll just change this a little bit i've add so let me save this come back and reload we shall see that we have quite a number of things in here we have titles and fields and zip and when we reach all the way down shipping enabling tax currencies we're able to see that we can tap in and add other IDs in the different sections that we do have so similarly we're going to tap into the section that is called general options and we're going to go for the section end in this particular place so we have our general options starting here where we have the selling location and the different countries we sell to the shipping and in this is where we're going to tap and add at the section end here is we're going to just add a few fields just before it so that's why we use this particular use that particular hook which is a filter of that information then we actually modify it so we'll tap these settings and we're going so we're going to get updated settings which is an empty array and then for each settings as we've seen we're going to have it as a section then we'll look for the general section using this if we'll use this if function to get the section ID that's called general settings and we shall try to look for the section type which is a section and an inside that if we fulfilled this whole conditional then we shall write some updated settings first we're going to have this field which has the maximum orders per day of course it has a description tool tip and that is essentially let me just save this so that we can reload and see what's happening so we reload this here this little tool tip here is what we're talking about it's the one that tells you why this field is available so this particular parameter in our array is actually why we have it so we give this an ID the field an ID of maximum orders per day then it will be a type number and we'll add CSS to which to be minimum of 300 pixels and of course we add the other information just to satisfy the different versions of Wukamas that we might have so for Wukamas less than 2 we have STD which is a field that is needed and we also have a default of 100 so we are filling in our number and saying we should have 100 orders per day and in Wukamas less than 2 we are also saying it should be 100 so depending on the Wukamas you have installed this will work and then we have a description for this particular field which is here and which says you must enter a number just above here now for the next field we have it with a message which is limited it has a tool tip and then i'm just going to attempt to change this here because i don't like the way it appears give it a CSS and then of course we give it a a standard message that would like to see so i'll reload this since i change it to a text area and i think it looks better we have our message in there and i think that is what we need so we'll move again now we'll get these up this array of updated strings we've been joining each to the empty array we had before so we passed in a new setting we add another field so for each of the different sections we are getting we're going to add these settings fields to the section that we had which is general are options and then after we return the updated settings and that's why we're able to get the two fields that we have here under general settings now once we have our fields added to make things a little more dynamic we then add in a new function which is a nebo catalog mode and this is just added into the init hook we check if we are in that bin area then we don't show anything but if we are on the front end that is otherwise we'll set some variables and we are getting the option that we have saved which is called maximum orders day and this particular option was saved actually here in this updated setting and that's what we have here so that's the option we are getting from our database we are adding a default message which is a we have exceeded our capacity and we are sorry so we cannot take your orders for today then we are also getting message that we had saved here we are getting it because it's saved as an option so we ask ourselves is the order capacity message that we have here empty if it is empty then we are going to set this new message as this as our new this will be set as our order message but then we'll have we'll not have the orders capacity message at empty at all then we what we do next is that we get the daily orders count so when we get the daily orders count which is a function we are having in this class if this function or what we return from this function is greater than or equal to the orders capacity then we remove the loop we remove the shop item that is adding to cut we remove the add to cut for the single pages we remove the pricing we remove pricing from all the different pages either from a single product or from the shop itself so we remove by tapping into these actions here and remove the messages or the buttons that are available so we edit the template that we do have there and if this orders is equal to or greater than the number that we have there then we pass a new notice wukamas function that says we're going to throw this message which is we have exceeded our capacity and we are sorry and then we throw that as a message we have already seen this in action and it's actually what we have here so this is how this plugin works the one thing that we haven't looked at is the daily orders function and now this function is actually receiving an argument of debt which is equal to now so what we do is that after this we use our global to query our database which is the global wpdb i have a video of how we can query database and it's actually in the link that has just shown up and this shows us how we actually query our database directly in wordpress so we are getting our wordpress database and querying by adding this SQL statement and it says let's get let's get the count we are counting how many orders we're counting how many orders we have those are posts with an id and we are getting them from the table which is posts and we are setting it as p so every time we use p we are saying let's go to the table of posts and find those posts in the word the post type is shop order so we're going for the custom post type which is shop order we are getting the debt of those posts and we are trying to make sure that either it is greater than today or it's in between the two days less than or equal to and then we are saying inside those posts we should check whether that post status is either on hold processing or completed so we have to know that it is not an order that has failed so it has to be any of these wukamas statuses which is a custom post status and then we shall return the result of this query of our database so that's how we find out how many uh actually how many posts or how many orders we have for that day so this particular function will give us that and that's why we're able to adjust the post it next to the order's capacity and run this code so that's how this whole function works and that's how we're able to have this so you don't have to close down your shop you don't have to feel beaten you don't have to feel like you're hopeless if you feel like you can handle more numbers then go ahead and increase how many fields you have in here so that your customers when they come to your shop they're able to shop however if you feel like today you've had more than enough just change that setting reload and close the shop you don't have to take in any more orders until tomorrow and automatically this functionality will work when tomorrow appears because the server will be queried to check if it's a new day and then it will start all over again so thank you for watching i hope this was hopeful i hope this will help you settle many of your queries in your shops that you're customizing and if you like the video please subscribe if you want to see more plugins that are reviewed this way let me know in the comments and let me know which plugins you want to work with and you want to have reviewed um we will try to endeavor to see how the code or if we can find a simpler solution than what is already there so thank you for watching and bye bye