This is a classic example where you sell a product by square meters, product price is setup in square meters too, but let the customer choose what is the unit of entered values.
Remember this is only a sample, we reccomend you to check value limits in your real product, we have some demos in that way.
The trick is that we have a selectbox with options in order to choose the unit, every text in those options is recognized by CFO_UnitConversion which performs the conversion (lines 10 and 11).
You can do it without this function of course, may be using a “switch” to detect selected option. (Take a look at this example: Selling printed banners)
Used function to unit conversion