function commerce_addressbook_commerce_customer_profile_insert in Commerce Addressbook 7.3
Same name and namespace in other branches
- 7.2 commerce_addressbook.module \commerce_addressbook_commerce_customer_profile_insert()
Implements hook_commerce_customer_profile_insert().
Set the new customer profile as default if there's none.
File
- ./
commerce_addressbook.module, line 333 - Defines addressbook functionality for customer profiles, allowing them to be reused and managed on a per-user basis.
Code
function commerce_addressbook_commerce_customer_profile_insert($profile) {
if ($profile->uid) {
$default_profile_id = commerce_addressbook_get_default_profile_id($profile->uid, $profile->type);
if (!$default_profile_id) {
commerce_addressbook_set_default_profile($profile);
}
}
}