170,187d169 < diff --git a/includes/commerce_cardonfile.entity.inc b/includes/commerce_cardonfile.entity.inc < index 0e7d7bb..60e8759 100644 < --- a/includes/commerce_cardonfile.entity.inc < +++ b/includes/commerce_cardonfile.entity.inc < @@ -151,9 +151,11 @@ class CommerceCardOnFile extends Entity { < $save_result = parent::save(); < < if ($save_result !== FALSE) { < - // If the card is now instance_default, remove the flag from other cards. < - $is_update = isset($original); < + // We cannot consider operation as update when original card has uid 0. < + // If we would, one user would end up with multiple default cards. < + $is_update = isset($original) && ($original->uid != 0); < $value_changed = $is_update && $this->instance_default != $original->instance_default; < + // If the card is now instance_default, remove the flag from other cards. < if ($this->instance_default && (!$is_update || $value_changed)) { < $query = new EntityFieldQuery(); < $query->entityCondition('entity_type', 'commerce_cardonfile');