I got a customer model and want to get the primary billing / shipping address. I tried it like this:
$customerObj->getPrimaryBillingAddress();
$customerObj->getDefaultBillingAddress();
$customerObj->getPrimaryShippingAddress();
$customerObj->getDefaultShippingAddress();
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?
Best Answer
I found a way, but I want to call it "workaround".
If you fetch the customer model like this
you will receive a customerObject without any address data.
What we can do is fetching the customerId like this:
And here we go:
Here we get the customerObject including all address data. Functions like
are now possible without returning
bool(false)
.