So I'm going to come to this page later because this lesson this up this page requires a lot of work
place order.
And before actually before working on this, we need to work on every important thing in the check out.
We cannot allow the user to check out if if the card is empty.
So let me explain what I mean.
So if I go to the cart here and if I either product, but if I change my mind and remove that product
and if I click on check out, it's going to take me to the checkout beach so the user will be able to
check out even though there is nothing in the cart and this is a problem, this is about to fix this
bug we need here in the checkout at the top, we need to check whether the card is empty or not.
So we need to save HP and then we need to say, you going to check?
We need to say session start and then we need to check this issue.
I'm going to say if.
If.
He's not empty.
Session.
Garth if the session is not empty.
And also we need to check if the user came to this speed through the checkout button or through an external
link.
So the user should come to the the check out page only from by clicking on this button.
If a user comes through the check out page from an external link, we shouldn't allow this because this
could pose a problem to our system.
So we need to check this button.
We need to check whether the user came to this page from the checkout or not, and that can be done
using here.
The is set is set, boss.
Most.
And then the name of the brand is Check Out.
Check.
And so if if these conditions are met, then.
Let the user in.
Ailes.
Else.
What we want to do.
We need to.
Send user to homepage because they cannot place an order if they don't have if the card is empty or
if the they if they came to the page through an external link.
So we need you to say hey there and then location.
Index got BHP.
Let me show you now what's going to happen.
So now if I go back to the homepage, when you go to the homepage, now, let me add something to the
card.
See this product card.
And if I click on checkout, I will be able to go to the checkout page because there is there is there
is a product in the in the cart.
There is a product.
Obviously, there is a product in the cart.
Let me show you that one more time.
If you go through the card, there is a product in the cart.
Obviously there is a product.
But if I remove this product, let me remove this product.
And now I don't have anything in the cart.
The cart is empty.
If you click on check out, I will be taking to the homepage.
Let me show you that one more time.
So let me go to the card.
Let me add something to the cart.
Alamy.
Remove it from the cards.
Let me remove this from the cards.
Now there is nothing in the card.
If I click on check out, I will be taking to the homepage.