Calculated Fields Form Blog

Tips and cases of use for a successful WordPress website with calculated forms.

Blog / Converting values between different units of measurement, and using products' prices from the equations.

Converting values between different units of measurement, and using products' prices from the equations.

Welcome to the two new members of the marketplace. The "Converter for Calculated Fields Form" and the "WooCommerce Products And Variations Prices for Calculated Fields Form" plugins.

We have received many requests from users about converting between different units of measurement, from meters to inches, degrees Celsius to Fahrenheit, years to seconds, etc.

As a solution for all these users, we have published the Converter for Calculated Fields Form.

The "Converter for Calculated Fields Form" plugin makes available to users the CFFCONVERTER operation.

The CFFCONVERTER operation accepts four parameters: value, current unit of measurement, the new unit of measurement, precision (optional).

CFFCONVERTER(100, "Meters", "Kilometers", 2) = 0.10

The units of measurement supported are:

LENGTH Nanometers, Microns, Millimeters, Centimeters, Decimeters, Meters, Kilometers, Inches, Feet, Yards, Miles, Nautical miles

WEIGHT Carats, Milligrams, Centigrams, Decigrams, Grams, Dekagrams, Hectograms, Kilograms, Metric tonnes, Ounces, Pounds, Stone, Short tons, Long tons

TEMPERATURE Celsius, Fahrenheit, Kelvin

ENERGY Electron volts, Joules, Kilojoules, Thermal calories, Food calories, Foot pounds, British thermal units

AREA Square millimeters, Square centimeters, Square meters, Hectares, Square kilometers, Square inches, Square feet, Square yards, Acres, Square miles

VOLUME Milliliters, Cubic centimeters, Liters, Cubic meters, Teaspoons (us), Tablespoons (us), Fluid ounces (us), Cups (us), Pints (us), Quarts (us), Gallons (us), Cubic inches, Cubic feet, Cubic yards, Teaspoons (uk), Tablespoons (uk), Fluid ounces (uk), Pints (uk), Quarts (uk), Gallons (uk)

SPEED Centimeters per second, Meters per second, Kilometers per hour, Feet per second, Miles per hour, Knots, Mach

TIME Microseconds, Milliseconds, Seconds, Minutes, Hours, Days, Weeks, Years

POWER Watts, Kilowatts, Horsepower, Foot-pounts/minute, Btus/minute

DATA Bits, Bytes, Kilobits, Kibibits, Kilobytes, Kibibytes, Megabits, Mebibits, Megabytes, Mebibytes, Gigabits, Gibibits, Gigabytes, Gibibytes, Terabits, Tebibits, Terabytes, Tebibytes, Petabits, Pebibits, Petabytes, Pebibytes, Exabits, Exbibits, Exabytes, Exbibytes, Zetabits, Zebibits, Zetabytes, Zebibytes, Yottabits, Yobibits, Yottabytes, Yobibytes

PRESSURE Atmospheres, Bars, Kilopascals, Millimeters of mercury, Pascals, Pounds per square inch

ANGLE Degrees, Radians, Gradians

The second marketplace member is the "WooCommerce Products And Variations Prices for Calculated Fields Form" plugin.

With the "CFF - WooCommerce" add-on, it is possible to integrate the form into the WooCommerce products to access their prices. However, the "WooCommerce Products And Variations Prices for Calculated Fields Form" plugin extends this possibility to the rest of the plugin's versions.

The "WooCommerce Products And Variations Prices for Calculated Fields Form" plugin generates the woocommerce_cpcff_product_price variable in the products pages, and the get_product_price operation. For form inserted into the products' pages, it is possible to use the product's price by using the woocommerce_cpcff_product_price variable as part of the equation. On other pages, it is possible to access the products' prices by calling the get_product_price operation, passing the products' ids as a parameter.

For example, assuming you have a product whose price corresponds to one square meter of the product, and the form includes two number fields, fieldname1 and fieldname2, for the width and length, respectively. And you want to calculate the cost of covering the area. The equation in the calculated field that calculates the cost would be:


If you configure the WooCommerce product as "variable" and every variation (corresponding to the different colors of the product) has associated a price, the previous equation would be the same. The plugin will update the cost every time the user selects a different variation (color).

If the form is not inserted on a product's page, but you need the product's price given its id, assuming the product's id is 123, you can implement the previous equation as follows:


Both plugins complement the "Calculated Fields Form" plugin.