Hi there
I am trying to get country ID in magento template files in the one page checkout... after the shipping method is chosen.
The issue that I am getting is that the country actually showing reflects the billing address, and not the shipping address when shipping address is different.
This is what I'm using in the template:
this->getQuote()->getShippingAddress()->getCountryId();
I have also tried this with the same result:
Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getCountryId()
Thanks
M
Solved! Go to Solution.
Thanks for your reply Rakesh!
This is on the one page checkout, and I now realize that I have been running these functions outside of where the ajax content is inserted. I think this should work, provided that the code is run in the template that is inserted into the one page checkout tab via ajax (because otherwise, the code is run when the page is loaded and before the customer changes their shipping address).
Try with below solutions,
$checkout = Mage::getSingleton('checkout/session')->getQuote(); $getShippingAddress = $checkout->getShippingAddress(); var_dump($getShippingAddress);
You can also try with,
$getCountry = $this->getQuote()->getShippingAddress()->getCountry();
Thanks for your reply Rakesh!
This is on the one page checkout, and I now realize that I have been running these functions outside of where the ajax content is inserted. I think this should work, provided that the code is run in the template that is inserted into the one page checkout tab via ajax (because otherwise, the code is run when the page is loaded and before the customer changes their shipping address).