Drupal Commerce Shopping Cart Form Alter I'm trying to use hook_form_FORM_ID_alter() in my theme's template.php file to change the 'Remove' button in the Commerce add to cart form to an image button. To do this I'm using the following code:

function tempestra_form_views_form_commerce_cart_form_default_alter(&amp;$form, &amp;$form_state) {
  foreach($form['edit_delete'] as $item) {
    if($item['#type'] == 'submit') {
      $item['#type'] = 'image_button';
      $item['#src'] = base_path() . drupal_get_path('theme', 'tempestra') . '/images/search.png';
      unset($item['#name']);
      dpm($item);
    }
  }
}


When I look in the array printed by dpm() everything is as it should be, however the HTML for the image button isn't printed.

Thanks in advance.
Simple mistake, you don't change $form but only $item if you did

foreach($form['edit_delete'] as &amp;$item) {


or

foreach($form['edit_delete'] as $key =&gt; $item) {
  ...
  $form['edit_delete'][$key] = $item;
}


it should work.