I am trying to "hide" individual line item values on my shopping cart. Is there a way to combine line items (possibly based on a term applied to each) such that they show as 1 item with the subtotal as the unit price?
As an example:
ungrouped:
- item A - $100
- item B - $50
- item C - $25
- item D - $200
- item E - $50
- item F - $25
grouped
- item A, B, C - $175
- item D, E, F - $275
where line items A, B, C would be tagged when added to cart as Group 1 and C, E, F would be tagged with Group 2.
I am not sure this is doable in the View directly; but possibly in one of the view alter hooks?
Update:
I am able to use hook_views_pre_render on the commerce_cart_form. From there I can access the line items, evaluate them and remove the line items I want to group in to main item. I just need to sort out what I need to modify to alter the displayed price of the main item. My guess is that I can't easily to do it here without saving the Order Item. I don't really want to modify the Order at all. I just want to display the cart differently.
Update 2:
Starting to think this is not possible without modifying the stored line item entity. Even preprocessing the Views table where I have access to each cell of the table; it seems as though $variables['rows'] does not use its values from the preprocess function.
Perhaps JS is the only (ugly) was to accomplish this. :(