I would like to get all customer shipping address to give shipping selection option in product view page itself.
I created a block to appear inside product view page. And I have below code snippet.
It gives all address including billing address.
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
$customerData = Mage::getSingleton('customer/session')->getCustomer();
$address = Mage::getModel('customer/address')->load($customerData->getId());
echo '<pre>'; print_r($address); echo '</pre>';
}
How to get only shipping address in magento?
Best Answer
The customer won't always have a default shipping address saved, however if they do you can get it like so :
Your just missing the
getDefaultShipping()