I got a customer model and want to get the primary billing / shipping address. I tried it like this:





But it just returns bool(false). I am using Magento 1.9 and I am sure, that there is a PrimaryBillingAddress set for the customer.

What am I doing wrong?

  • It returns bool(false) when default billing or default shipping address is not set for customer May 2, 2016 at 9:02
  • I figured out, that there is no address data set on the customerObj, but in backend and database it is set. Any suggestions for getting the customerObj what includes the addresses? May 2, 2016 at 9:28
  • call getAddressCollection() method on customerObj and check what you are getting ? May 2, 2016 at 9:38

2 Answers 2


I found a way, but I want to call it "workaround".

If you fetch the customer model like this

$customerObj = Mage::getModel('customer/customer')
->addAttributeToFilter('eav_attribute', $eav_value)

you will receive a customerObject without any address data.

What we can do is fetching the customerId like this:

$customerId = Mage::getModel('customer/customer')
->addAttributeToFilter('eav_attribute', $eav_value)

And here we go:

$customer = Mage::getModel('customer/customer')->load($customerId);

Here we get the customerObject including all address data. Functions like


are now possible without returning bool(false).


A bit late to the party but some extra info for you.

I was debugging why I could not get the default addresses in the Magento customer_save_after event, and I too was just getting falses...

This is because after save, the addresses are saved (of course) and assigned ID's, however the Customers address collection does not assign these new id's to the private "getByIds" array map inside of it.

As SimonSolutions eludes to, by reloading the customer Model the addresses are also reloaded, becasue they are loaded (not added then saved) the id map gets correctly populated.

There is some overhead in reloading the whole customer model though, I have found the following snippet works to reload just the address collection, thus reducing the reloading overhead.

this is an alternative for future searchers, Kudos still belongs to SimonSolutions for the origional answer of course but this may help others :

//assuming $customer is our customer model

//clear address collection
//note do not daisy chain this method as it does not return the customer object!

//getting default addresses now works!
$myDefaultBill = $address->getDefaultBillingAddress();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.