I need to add a custom function to the Confirm Order button on a Commerce Checkout form. I can't figure out how to call it. The button ID is #edit-continue and its displayed text is Confirm Order. I thought this would show up in the $form[submit]
array, but that array is empty. So I checked $form['buttons']['continue']['#submit']
, which seems to be where Drupal Commerce stores the submit functions.
I created a module and two functions.
function MYMODULE_form_commerce_checkout_form_checkout_alter($form, $form_state, $form_id){
drupal_set_message('ALTERING CHECKING OUT! THIS WORKS' . $form_id);
$form['buttons']['continue']['#value'] = 'Send Me A Quote!';
$form['buttons']['continue']['#submit'][] = 'MYMODULE_submit';
function MYMODULE_submit_function($form, &$form_state) {
die('Triggered submit');
}
drupal_set_message()
shows the message, but the submit function isn't invoked, and the text in the button is not altered. So clearly, the problem is that I am not targeting the button properly. How do I "address" that button?
To make it clearer, I need to overload that button, not replace the commerce checkout functionality.
PS: I have no access to the console or Devel. So I'm limited to debugging with var_dump().