If the user creates a profile, and there are no other active profiles of that type, then the new profile should be set as default.

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

bojanz’s picture

Status: Active » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Carlitus’s picture

It is automatic? I've created a new order using a new user and the only customer profile is not the default.

Carlitus’s picture

And when i set as default one address using the link in the user page it doesn't prepopulate in the checkout.

¿i'm missing something?

Lukas von Blarer’s picture

joshmiller’s picture

Status: Closed (fixed) » Active

Instead of creating a new issue for the same problem, let's reopen this issue.

jsacksick’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Kiampp’s picture

I am using the stable release and I would love to see this implented in that release.
Any idea if and when that might happen?
It is a small thing but it makes ordering a little bit easier/faster for a repeat customer.

redsd’s picture

For people looking for quick solution, you can use the following module:

commerce_addressbook_fix.rar

The module will update the default profile of the user as soon as he or she changes his delivery adress from the dropdown or when making a new delivery address.

or use the following code:


function commerce_addressbook_fix_commerce_addressbook_callback_alter(&$commands, $form, $form_state) {
  // Example.
  global $user;
  $profile_id = $form_state['values']['customer_profile_shipping']['addressbook'];
  if(is_numeric($profile_id)) {
    $customer_profile = new stdClass();
    $customer_profile->uid = $user->uid;
    $customer_profile->type = 'shipping';
    $customer_profile->profile_id = $profile_id;
  
    commerce_addressbook_set_default_profile($customer_profile);
  }
}

function commerce_addressbook_fix_entity_insert($entity, $type) {
  global $user;
  if($type=='commerce_customer_profile'){
    
    $customer_profile = new stdClass();
    $customer_profile->uid = $user->uid;
    $customer_profile->type = 'shipping';
    $customer_profile->profile_id = $entity->profile_id;
  
    commerce_addressbook_set_default_profile($customer_profile);
  }

}