Skip to content

Instantly share code, notes, and snippets.

@mglaman
Created January 5, 2016 16:10
Show Gist options
  • Save mglaman/630b53d1ffe40f6de790 to your computer and use it in GitHub Desktop.
Save mglaman/630b53d1ffe40f6de790 to your computer and use it in GitHub Desktop.
<?php
// HINDSIGHT: Don't use presave. You'd need save (right, that exists?)
function mymodule_commerce_customer_profile_save($profile) {
if (isset($profile->my_custom_boolean)) {
// Okay so the field was set, or exists on this bundle.
if (!empty($profile->my_custom_boolean[LANGUAGE_NONE][0])) {
// Okay, we have a value (double check this var)
variable_set('commerce_addressbook_defaults', $profile->id);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment