how do we add a submit handler in drupal commerce everytime a product is created.
I tried using the following code.
function custommodule_formid_form_alter(&$form, &$form_state, $form_id) {
$form['#submit'][] = 'custom_submit_function';
return $form;
}
function custom_submit_function() {
print "<pre>";
print_r($form_state);
print "</pre>";
die();
}
Is this the correct way?
I tested it, and actually managed to get the form submit new handler works, but the problem is after the form is submitted, I wanted to get the submitted data and manipulate it. It is not working out as the form data is all gone.
function custommodule_form_alter(&$form, &$form_state, $form_id) {
$form['#submit'][] = 'custom_submit_function';
}
function custom_submit_function($form, &$form_state) {
$value = $form_state['values']['field_data'];
}