I created a boolean field using a radio button widget through the UI. I set a default value but when I go to the checkout page, there's no value selected by default.

Comments

brogdawg’s picture

Issue summary: View changes

I am experiencing the same issue. Boolean field with on off checkbox. Setting the default to be on (checked) doesn't default the field to be checked on the checkout pane.

brogdawg’s picture

As a workaround I ended up setting the default value to 1 (checked) in a hook_form_alter in my custom module. Here is the code.

function YOUR_MODULE_form_alter(&$form, &$form_state, $form_id) {
   if($form_id == 'commerce_checkout_form_checkout') {
      $form['commerce_fieldgroup_pane__group_YOUR_FIELDGROUP']['field_YOUR_FIELD']['und']['#default_value'] = 1;
   }
}
xandeadx’s picture

Category: Support request » Bug report