I'm looking on how to check if i'm standing at checkout payment page, which have url "fudu.magento.net/checkout/#payment
" by php or by js.
I was trying to use to get url, but it always return checkout_index_index
To be clear, i want to compare between shipping page and payment page, which have url is "checkout/#shipping" and "checkout/#payment".
EDIT 1: I've trying using script to check css display:none of #shipping, but it doesn't work either, because when i click "next" in shipping page, it will not render any js out after that.
my js code:
function checkIfPaymentPage(){
if($('#shipping').css('display') == 'none'){
console.log('worked');
}
}
After i click "next", nothing appear in inspect console:
EDIT 1:
I'm using window.setInterval(function(){ //code }, 3000);
and it worked for me to testing, but i don't thing this is the best practice, so if you guys have any other solutions, please tell me 🙂
Thanks for reading.
Best Answer
To get checkout page url, try this:
Hope it works.