I've been trying to skin this cat for a long time so there are several related questions. Plain vanilla D7 Commerce shopping cart. HOWEVER, the line item pricing we want to use is grabbed from an external database via XML requests. It can never be determined from the Products table because there are all kinds of discounts that change all the time.
My -main- problem is that the Shopping Cart View in Commerce seems to automatically calculate and update the Unit Price and Extended Price for each line item before the shopping cart page is rendered. I've read the Commerce tutorials and apparently this is referred to as a 'Status'... calling commerce_cart_order_refresh().
I've tried using a pricing rule to get the price for each line item, but that means an http request for each line item which is dead slow.
So I added a function to hook into the Shopping Cart view BUT it seems to fire -after- the page is actually rendered (but before the visitor sees it on screen.) So the upshot is that the visitor has to hit refresh in order to get the correct pricing. IOW: when they first visit the Shopping Cart they get 0s for the pricing. They click again and they see the correct prices.
How do I hook into the Shopping Cart View so that my function fires -before- the form is rendered?
How do I DISABLE the automatic price update for each line item (since my function has already updated the line items and order totals.) I assume this is happening in commerce_cart_order_refresh(). Is there a way to force that calculation to FALSE?