Overriding price via hook?

I have a client whose requirement set is bizarre and non-negotiable. They need the pricing calculated dynamically based on the customer's state and information contained within the product itself.

I'm considering Commerce for this, but I have yet to find a hook that will allow me to simply adjust the price of a given product before it is displayed or totalled as part of the checkout process.

Is there a hook I'm missing that would allow me to do this? Or is it possible to write a Rule that would have access to all of this information?

Posted: Feb 27, 2013


jgpippin on February 28, 2013

I appreciate that, and I think that link will be super-helpful. But I really would like to find a way to do this in a sane way - with code. Is there really no hook for that?

jgpippin on March 2, 2013

My client's needs are odd, and were set up using Ubercart. The client sells in multiple states, and pricing is calculated differently for each state. It's set up this way:

Each product contains four node references, one for each state the product might be sold in.
The node references point to 'scheme' nodes, which contain all the values needed to calculate the final price.
When the price is viewed or the item is put in the cart, we use the customer's state to determine which pricing node to use, load that node, and use the values from that node to calculate the final price.

This is much too complicated to do with Rules. I'm hoping there's some way to execute my own PHP code to calculate the final node.