Unable to print form element
Take the $form = array(); line out of the foreach loop. This is clearing the $form array every time it loops around. You don't want it to do that.

foreach ($line_items as $line_item_id =&gt; $line_item) {

   $option_first = array(1 =&gt; '1', 2 =&gt; '2', 3 =&gt; '3', 4 =&gt; '4', 5 =&gt; '5', 6 =&gt; '6', 7 =&gt; '7', 8 =&gt; '8', 9 =&gt; '9');

   $form['line_items'][$line_item_id]['quantity'] = array(
     '#title' =&gt; 'Qty',
     '#type' =&gt; 'select',
     '#options' =&gt; $option_first,
     '#default_value' =&gt;  $line_item-&gt;quantity,
   );
}


Also, if $order_id is a argument, you should not need to call arg(1). Consider passing the commerce order object as an argument instead, using %commerce_order as a URL parameter. Drupal will load it and pass it for you (if this function is a menu item callback).