Dynamic Pricing and Fixed Price Products
-
We have a product, a software upgrade, that is priced based on what other products the user already owns.
We hook into woocommerce_product_get_price which gets passed the price in our native currency pounds and returns the price with the dynamic discount applied.
If we have a fixed price in a current, e.g. dollars, for the upgrade we would like to perform the calculation using the fixed price so that the users pricing is not subject to variations in exchange rate.
I could do this in the woocommerce_product_get_price hook by:
- Getting the users current currency
- Getting the fixed price for the upgrade product for this currency
- Performing the price calculation using this fixed price
- Converting the value back to our native currency
- Returning this from woocommerce_product_get_price
But this seems pretty ugly. Also how would i get the users current currency, the fixed price and the exchange rates being using by CURCY programmatically?
Is there a better way? Happy to pay for an hour of someones times for some support with this ??
Or are you overriding woocommerce_product_get_price as well and I just need to get my hook in the right order with yours?
- You must be logged in to reply to this topic.