Dynamic Pricing and Fixed Price Products

[ad_1]

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?

  • This topic was modified 17 minutes ago by jcredland.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer