Skip to main content
1 of 4

Drupal 6 Ubercart 2 / 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->products as item){
          $cost += $item->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.