You are here

function commerce_ss_checkbox_validate in Commerce Stock 7.2

Element validation callback for the decimal checkbox.

1 string reference to 'commerce_ss_checkbox_validate'
commerce_ss_form_commerce_product_ui_product_type_form_alter in modules/commerce_ss/commerce_ss.module
Implements hook_form_ID_alter().

File

modules/commerce_ss/commerce_ss.module, line 119
Allow commerce products to have stock levels associated with their SKU.

Code

function commerce_ss_checkbox_validate($element, &$form_state, $form) {

  // Get the product bundle type.
  $type = $form_state['product_type']['type'];

  // Check if stock enabled for the type.
  if (commerce_ss_product_type_enabled($type)) {

    // Set the configuration option for decimal stock.
    variable_set('commerce_stock_decimal_backend_' . $type, $form_state['values']['product_type']['decimal_admin']);
  }
}