You need to set it the other way around. The default_billing for the customer.

$customerId = 1234; // Customer id
$data = array(); // Address data

$customer = Mage::getModel('customer/customer');

// Load customer
$customer-&gt;load($customerId);

// Get current address
$address = $customer-&gt;getPrimaryBillingAddress();

// Do we add a new address
$isNewAddress = false;
if (!$address) {
    $address = Mage::getModel('customer/address');

    $address-&gt;setCustomer($customer);
    $isNewAddress = true;
}

// Append data
$address-&gt;addData($data);
$address-&gt;save();

if ($isNewAddress) {
    // Add address to customer and save
    $customer-&gt;addAddress($address)
        -&gt;setDefaultBilling($address-&gt;getId())
        -&gt;save();
}


How can I create and retrieve default billing address programatically?
I've got three omnibus books containing 9 total Warhammer 40,000 stories.  Before I mention which ones I've got, which book would you recommend as a good place to start the series?
