Add line item showing total cost How can I add a line item in Ubercart 2 that adds up the total cost of all items, not the sell price? I have tried to clone the generic line item hook, and add something like this for the callback:

for each($op-&gt;products as item){
  $cost += $item-&gt;cost;
}


I need this line item to appear in the cart (I'm using the ajax cart), in the order pane before the user completes checkout, and in the emails that the store owner and user get. Do I need to create a little module for this code outside of uc_order? I don't remember the code exactly as it's on my work computer, but I think I'm putting it in the wrong place. Thanks for any pointers.
I created a line item using hook_uc_line_item() then added the line item in the hook_uc_order().

Final products looks something like:

/*
 * Implement hook_uc_line_item()
 */
function my_module_uc_line_item() {

  $items[] = array(
    'id' =&gt; 'handling_fee',
    'title' =&gt; t('Handling Fee'),
    'weight' =&gt; 5,
    'stored' =&gt; TRUE,
    'calculated' =&gt; TRUE,
    'display_only' =&gt; FALSE,
  );
  return $items;
}

/**
 * Implement hook_uc_order()
 */
function my_module_uc_order($op, $order, $arg2) {

  // This is the handling fee. Add only if the user is a professional and there
  // are shippable products in the cart.
  if  ($op == 'save') {
    global $user;

    if (in_array('professional', array_values($user-&gt;roles))) {


      // Determine if the fee is needed. If their are shippable items in the cart.
      $needs_fee = FALSE;
      foreach ($order-&gt;products as $pid =&gt; $product) {
        if ($product-&gt;shippable) {
          $needs_fee = TRUE;
        }
      }

      $line_items = uc_order_load_line_items($order);

      // Determine if the fee has already been applied.
      $has_fee = FALSE;
      foreach ($line_items as $key =&gt; $line_item) {
        if ($line_item['type'] == 'handling_fee') {
          $has_fee = $line_item['line_item_id'];
        }
      }

      // If the cart does not already have the fee and their are shippable items
      // add them.
      if ($has_fee === FALSE &amp;&amp; $needs_fee) {
        uc_order_line_item_add($order-&gt;order_id, 'handling_fee', "Handling Fee", 9.95 , 5, null);
      }
      // If it has a fee and does not need one delete the fee line item.
      elseif ($has_fee !== FALSE &amp;&amp; !$needs_fee) {
        uc_order_delete_line_item($has_fee);
      }
    }
  }
}