Drupal commerce change quantity textfield in cart view to selectbox
&lt;?php
/**
 * Implements hook_form_alter().
*/
function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {
 if (strpos($form_id, 'commerce_cart_add_to_cart_form_') === 0) {
   if (isset($form['quantity']) &amp;&amp; ($form['quantity']['#type'] == 'textfield')) {
     $form['quantity']['#type'] = 'select';
     $form['quantity']['#options'] = drupal_map_assoc(range(1,10));
     $form['quantity']'#default_value' =&gt; 1,
   }
 }
}


?>