 In our last video we were able to add a very simple extra cost to our order in Wokamas by having just these five lines of code and we did this by adding a small plugin and we created our own plugin using these few lines of code 16 and eventually we got this in our back end as the package cost extra fee. Today I want to try to make a variation of when you don't just have a static pricing so we're going to have something that is dynamic in other words that would be maybe we want to check on our total in the cart and then add it by a percentage. Let's say we're going to be looking for the tax system of our particular state in our state for example the tax ratio is 18% so for example in Uganda where I'm living we have what we call VAT which is the value added tax and what it takes is that it is a value of 18% of the total of your whole order so it is 18% of your whole order so 18% here you would have to multiply but we'll see that in action. Now in computer language this percentage actually means something else so rather than writing 18% we actually just add the zero point we move the decimal places two places behind and then we'll have 18% recorded as this so it is the tax value. Now in order for us to get the amount that is taxable we have to get this value from WooCommerce which is do this so in our brackets we're going to wrap everything around in brackets and we're going to add the WooCommerce and then we're going to chain onto it the cart and then we're going to chain onto it cuts cuts content total so we get the cut contents total and then we are going to multiply it with our percentage of 18% now all we need to do is actually just get this and copy it and replace it with the five so when we have that in here so we're getting our VAT which is taxable we get it by getting the cuts sub total here and then we multiply it with our percentage and then eventually we feed it in in our add fee function so I'm going to save this come back here and reload and when we reload we're going to say that we actually have a VAT of 8 UGX and that is the actual value that we're taxed and then we have a total here calculated and ready for us to be paid in our WooCommerce using our payment gateway now if for particular tax systems they actually first get a flat rate they have a flat rate which is going to equal to let's say five shillings now notice that I don't use any symbols like dollars or UGX on our values of money that we have here that's the way it should be because WooCommerce automatically will add for you these values here so you don't need to add anything like dollar because now this would be something completely different in programming so we have a flat rate of five and then after getting the five five shillings we then add on a percentage of our total cut total so in this case we would still get our calculation that we have here of 18 percent and we're going to say we're going get the flat rate then on it we're going to add this calculation that we have here after calculating we get our taxable value and then we just add it in here so when I save this come back and reload come back and reload this we'll see that now before we had eight shillings but now we have 13.28 so this is how we properly add our tax our flat rate and also add a dynamic calculation inside our WooCommerce shop so thank you for watching this video if you enjoyed it give it a thumbs up don't forget to subscribe and share with your friends