How to add a new CSS class to a Drupal7 ?
You need to add it to the #attributes key of the $form array:

function shop_form($form, &amp;$form_state, $nid) {
  $form['#attributes']['class'][] = 'cart'; // Classes are added to an array and internally converted to a single string by Drupal later on

  $form['my-item-name'] = array(
    '#type' =&gt; 'hidden',
    '#title' =&gt; t('Name'),
    '#value' =&gt; isset($node-&gt;title) ? $node-&gt;title : '',
  );


  return $form;
}