 Welcome back in today's video. We are going to be fixing a couple of bugs and then pushing our theme a little bit forward. So currently, when we choose our pizza here and we choose to add some BBQ steak pizza and add a small pepperoni and small olives and click Add to Cuts, we are currently experiencing a freeze in what we have here. But if I reload, you will see that we have only one item being added here yet. We chose to add two different items. So I'm going to clear out my mini cut right now, reload this and I'm going to start debugging the process. And the first thing that I'll use is my inspector and I'm going to go to the console. This console will allow us to see the errors that come from our JavaScript on our front end. So what I'm going to do is open up my editor. I'm going to open up the files that are affecting this whole process, which is the food, add, dash, add, digest and also the functions that PHP, which actually has our Ajax file or Ajax function running here. So I'm going to do a couple of cleanups. The first thing that I will do is remove this loop and then we're going to have our Ajax starting at a top level. And then I'll remove line 31 because we no longer need that. And the first thing that I'm going to do here is I'm going to actually console log this. And what we're going to console log is the values to see that we get all the IDs of the variations when we click the add to cut button. So we're going to be able to see those inside our console and I'll pass those values right here as variations. Now after doing that, we are going to actually come back to our functions and we want to tap those variations. This time it's going to be an array. So we can don't make it an absolute integer. So I'll remove this and I'm going to call this variations right here. Let me just cross check this to make sure everything is as it should be. Yes. And what we're going to do is WP die here because we don't want to continue after this point. And what we want to do is actually use the error log function which is default to PHP. And what we want to do in there is we want to print R and what we shall be printing is actually these variations. So we'll get the variations here. This should be true so that we can error log our variations. Now after tapping that, I'm going to just clean this up a bit so that it looks nice and clean. So after writing this error log here, we need to tell our WordPress to actually debug all our issues that we're having and it should be logged. So I'm going to go into my root folder here and I'm going to choose this WP dash config file. And what I'm going to do here is define the constants which are meant for the WP debug. So here we have WP underscore debug and we're going to turn this to true and then I'll duplicate this twice so that we can have also the WP underscore debug underscore log and also the underscore display for the debug. So this will allow us to see the particular debugging we are doing in our functions PHP inside this file that exists inside the WP dash content and it will give us this debug log file right here. So right now we can see that it's empty. Let me go back to my front end. So I'll go to pizza. I'll choose margarita pizza. I'll choose the large pepperoni and medium olives. Click add to cut. You'll see here we're told 17 and 19 are the variations that have been passed. And then I'm going to go back to mydebug.log and you will see that we actually have 17 and 19 being passed to our Ajax. So meaning we have a nice array of data here. So I'm going to go back to our functions here and I'm going to comment this out. And what I want to do is use a for each statement. Now this for each statement is going to run all our code that's down here with the exception of this WP die and I'll push it up a little higher. And we're also going to comment out this WP send JSON which we don't need right now. We're using it for debugging earlier and so inside this for each loop we're going to say for each one of those variations. So I'll say as variation ID so that we can be able to get this variation ID right here. So I'll save this and we expect this to run twice. If we choose two items thrice, if we choose so many items let's go ahead and see that on the front end. So I'm going to come back here. I'll clean this out to make sure we don't get any errors. I'll reload this here. I'm going to go to our pizza. I'll choose the barbecue steak pizza. I'll choose the small olives and the large extra cheese. Click add to cut. We have 25 and 32 going in there. What we need to do is just close this. I'll reload it here. And you'll see here we now have our barbecue steak pizza coming in with the small olives. And we also have our large extra cheese actually showing up here. So this is what we actually wanted to have. And now we have only one issue that is left. Whenever we add new items to this page we have to close this ourselves and then do a reload to have our items go inside our cut. So we're going to do a very little minimal fix for this so that we can be able to do that all on our own. So what I'm going to do is I'll come back here to our food dash add.js. And inside here I'm going to choose so I'm going to tap the window that we have here and then I'll look for the location and I'm going to say let us reload this particular page. The same page we've been on let's reload it using this method that comes from JavaScript. So this particular line of code I would want to put it inside this place whenever we have a success. So that will allow us to reload. So I'm going to save this. I'll come back to the front page. I'll reload this. Of course having cleared our cut. I'm going to go to pizza. I'll click the margarita. I'll choose the medium and the small olives. Click add to cut. That was successful. You'll see that we have these items added right here. I'll go back to pizza again. Choose the barbecue. Add small pepperoni with the large pepperoni. Click add to cut. We have a success. And you'll see that we have also these particular items added in here. Now this is one of the few bugs that we wanted to fix. And this sends us off on a different trajectory and it makes us move ahead with our theme development. So if you enjoyed this video, make sure to give it a thumbs up. And if you're enjoying the content that's coming from here, consider subscribing if you haven't. Let all your friends know that there's something going on on the Techie Press channel. Let them subscribe and also get some good knowledge from here. Otherwise, enjoy the coding that you are doing.