WooCommerce measurement price calculator: calculate price by formula

Create simple or complex formulas based on user inputs

Not all WooCommerce products are sold in simple units; and sometimes the standard quantity field isn’t enough for your customer. If you’re selling products that have prices calculated by area, volume or other custom units, you’ll want your customers to be able to enter their desired dimensions then have WooCommerce calculate the product price by a formula. That’s where a WooCommerce measurement price calculator comes in.

WooCommerce measurement price calculator

If you want to sell products which are priced by a non-standard unit, like area or volume, you’ll need a measurement price calculator plugin. This will let you and your customers calculate the product price according to user-inputted measurements.

The WooCommerce Product Add-Ons Ultimate plugin includes a price calculator option. Its ‘Calculation’ field allows you to calculate part or all of the product price according to your own formula.

But it’s far more than a price calculator plugin. Add-Ons Ultimate also lets you add extra options to your products using input fields like text, number, select, etc.

In this article, we’ll look at:

  • How a WooCommerce measurement price calculator works
  • How the price calculator works in conjunction with other add-on fields
  • Some different real-life examples of products using a measurement price calculator

Remember: you’ll need the Pro version of the plugin to use calculation fields.

You can navigate through the article using the links below:

Calculate WooCommerce product price by formula

Using the calculation field, you can set complex prices based on multiple factors using mathematical formulas. It’s perfect if you’re selling goods in quantities that are based on dimensions, for example:

  • Length
  • Width
  • Area, e.g. square feet or square metres
  • Volume, e.g. cubic inches, cubic centimetres or cubic metres
  • Weight by volume

Note that you can also calculate product prices based on a pricing grid. See this article for more information.


The calculation field uses the concept of ‘tags’. Basically, these are pieces of text that you can insert into a formula that will later be replaced by a numerical value.

For example:

  • The {field_932} tag will be replaced by the value of the field with the ID 932
  • The {product_price} tag will be replaced by the price of the product

You can also enter numbers as well, so your formulas will most likely be a combination of tags. In this article, we’ll look at loads of examples.

WooCommerce product price calculator for windows and glass

For example, let’s say you’re selling windows. You can create a standard WooCommerce product for your window product then, using the Add-Ons Ultimate plugin, you can add a couple of number fields where your customers can enter the height and width of each window.

WooCommerce product price calculator for window

Now, using the calculation field, you can decide how to price the product based on the area, calculated by multiplying the height by the width, plus any other factors that you want to include such as:

  • Cost of goods
  • Mark-up or margin
  • Base product price
Product price by formula for WooCommerce

The customer enters the height and width that they require and the calculation field takes care of the rest.

There is a more detailed walkthrough of a window measurement calculator product below.

Works with simple and variable products

The calculation field works with simple or variable products. In our windows example, maybe this means you can have variations for different frame styles or glass types.

Using multiple calculation fields

You can use the results from calculation fields in other calculations. This means that you can, if you wish, build up complex formulas.

Create global variables

If you’re using calculator fields on multiple products, you might want to be able to set some variables in one place. Let’s say your calculations allow for a 50% mark-up or margin then, one day, you decide you want to increase this to 60%.

You don’t want to have to go through every product and change each formula. It’s too painstaking and painful.

Instead, you can set a value for your mark-up in the settings and use a tag, e.g. {variable_1}, in all your formulas. If you need to change this value, you only have to change it in one place.

Product price calculation global variables

WooCommerce product price calculation formulas

The WooCommerce product price can be calculated using formulas which are simple or complex.

Formulas can include:

  • Add-on field values
  • Product price
  • Preset variables
  • Other calculation fields
  • Product dimensions (length, width and height) and weight

Formulas also allow you to use standard operators:

  • Plus
  • Minus
  • Multiply
  • Divide

And finally, you can specify how many decimal places to return results to. Or you can decide whether you want to round the result up or down.

WooCommerce Add-Ons Ultimate and price calculator plugin

Because the calculation field is part of the Add-Ons Ultimate plugin, you can do much more than just simple product price calculations.

You can create products that allow your customers to specify their precise requirements. Wondering why product personalisation is such a great feature? You should read this article.

As I mentioned before, because the price calculator is just one feature of the Add-Ons Ultimate plugin, you get loads of powerful extras. For example:

Conditional logic

Product Add-Ons Ultimate allows you to use conditional logic to decide which fields should be displayed to users. You can set conditions on most field types so you could include calculations based on:

  • Whether or not a checkbox is selected
  • If the user has chosen a certain option from a select field or radio button group
  • Only if the user has entered certain text in a text field
  • If the cost of the product is above or below a certain threshold

Variation specific fields

Maybe you only want to trigger a calculation if the user has selected a certain product variation. Add-Ons Ultimate allows you to display fields only when specified variations are selected.

Minimum and maximum values

The calculation field can look for the value of other add-on fields. In our windows example above, this would a number field for height and a number field for width.

With Add-Ons Ultimate you can specify minimum and maximum values for number fields – so if your windows can’t be bigger than a certain size, you can enforce this.

WooCommerce measurement price calculator examples

Now we’re going to look at a number of examples of product price calculators. We’ll walk through how to set each one up and link to a working demo product.

In total, we’ll look at:

  • A wallpaper roll calculator which calculates the number of rolls of wallpaper you’ll need depending on the dimensions entered
  • How to create a product for windows which allow you to specify the exact height and width
  • Simple products that are sold by length or meterage, like fabrics
  • Selling products by volume, e.g. gravel, pebbles, aggregates

All the products will have some additional options so you can see how the calculation field interacts with other product options.

Build a wallpaper roll calculator

Let’s look at how to create a WooCommerce product price calculator for rolls of wallpaper, or similar products. You can view the full working demo here.

Note that this is an example of a wallpaper calculator – but could work equally well for wall tiles, flooring, carpets, or any other product where you want to calculate an item quantity based on area.

WooCommerce measurement price calculator

The requirements here are:

  • Allow the user to calculate the area of the room to be wallpapered by entering the width and height of the walls
  • Factor in some some contingency for the area – so allow an extra ten percent additional to the user’s dimensions
  • Calculate the number of rolls, then round up to prevent the customer trying to purchase part rolls
  • Automatically setting the quantity field so that we can still track inventory and know how many rolls we’re selling

This sounds quite complex – but in fact it’s really easy with the calculation field.

Creating the calculation field for the wallpaper product

We need two user input fields – one for height and one for width. Make sure you specify the field type as ‘Number’.

(By the way, if you’re uncertain about the basics of adding extra product options with Add-Ons Ultimate, you can take a look at this article.)

For now though, let’s assume you’re familiar with adding groups and fields in the plugin. Here’s our ‘Width’ field for the wallpaper price calculator.

WooCommerce width option

It’s pretty simple – just a Number field with a label.

We can duplicate it for the Height field.

Adding the calculation field

Now we can add the WooCommerce price calculator field.

Our formula is relatively simple:

  • Essentially it’s the width multiplied by the height to get the area the wallpaper will need to cover
  • Then we multiply the area by 1.1 to give an additional 10% contingency
  • Finally, we divide by 3.5 (which is the area of one roll of our wallpaper). Obviously, it’s likely to be different for you.

The field looks like this:

WooCommerce measurement price calculator for wallpaper rolls

Note the Height and Width fields above the calculation field. We can see the field IDs for each.

The calculation formula is written like this:

( {field_907} * {field_908} * 1.1 ) / 3.5

Note that I’ve used some tags, e.g. {field_907}. That just means that the formula will grab the value of Field #907 (the Height) and use it in the formula.

Parentheses are allowed, so I’ll calculate the area first, then multiply by 1.1, then divide the whole lot by the area of a single roll.

Rounding the result

Because we want a whole number as our result and because we want to make sure our customer has enough wallpaper to finish the job, we set the ‘Round Result’ field ‘Round up’.

This will round the result of the calculation up to the nearest whole number.

Updating quantity

And because we want to use this field to specify how many rolls the customer will be buying, we set the ‘Action’ field to ‘Update Quantity’.

This means that when the user enters their height and width, the calculation will trigger an update in the Quantity field so that the user will purchase the correct number of rolls.

Upselling additional items

The calculation field is part of the Add-Ons Ultimate plugin – so you can include more options on the product page than just an area calculator.

You can encourage upsells by offering some typical equipment customers might need when they’re doing their wallpapering, like adhesive or tools.

These can be simple options or you can include other products on this page.

Change the price label

As a finishing touch, we’ll want to change the product price label so that the user understands the price is per roll.

Add-Ons Ultimate gives us a couple of extra fields on the ‘General’ tab of the Product data section.

You can enter some text in the ‘Price label’ field that will accompany the product price. Then you can decide where to display the text in the ‘Price label display’ field.

Setting the product price label

Take a look at the demo here.

Selling WooCommerce products by the metre

Many products may need to be sold by the metre or the foot (or the inch, centimetre, or mile – who knows?). In this example, we look at setting the price of lengths of fabric by using a simple calculation. You can view the demo here.

WooCommerce buy fabric by the metre

Create the add-on fields

Because we’re selling by length, we only need one user input field. Create a Number field and label it how you wish, e.g. ‘Length’.

Now you can create your WooCommerce price calculator field. The formula is simpler than in our wallpaper example:

WooCommerce product price calculation for products sold by length

The formula is simply:

{field_932} * 5.95

Where {field_932} is the value of the input field (i.e. the number of metres of fabric that the customer wants) and 5.95 is the price per metre.

Display as cost

Unlike the wallpaper rolls, where we were calculating the number of rolls then setting the quantity field to match, here we are setting the price directly.

To do this, set the ‘Action’ field to ‘Display as Cost’. This will return the result of the calculation as a price value and update the total product price accordingly.

Creating a WooCommerce measurement calculator to calculate price by volume

Let’s add another dimension now – depth. If you are selling materials that are measured by volume, equal by cubic metre or yard, you will need a measurement calculator.

In this example, we’re selling aggregate – i.e. pretty pebbles or gravel that we might use as a decorative feature in our garden. Your customers won’t necessarily know how much they’ll so we’ll provide them with a neat calculator.

Example product page for selling by volume

As a bonus, we’re also going to give the customer the opportunity to add a shovel to their cart direct from the aggregates page.

You can view the demo product here.

Add the calculation fields

As before, let’s add our calculation fields. We need Number fields for Length, Width and Depth.

Just to throw a spanner in the works, the Length and Width fields will be in metre units; the Depth field will be in centimetres.

Input fields

Note that I’ve indicated the units as part of each field label.

Create the product calculation formulas

In a similar way to the wallpaper calculator above, we’re going to create two calculation fields:

  • One field will calculate the volume based on the user inputs
  • The second field will calculate the number of bags of aggregate required based on the calculated volume and a global variable that we’ll set to indicate the volume of each bag
WooCommerce volume calculation formula

Note that we’ve accounted for the fact that the depth unit is centimetres by multiplying that field value by 0.01 to convert it to metres.

We return the result to 2 decimal places.

Price calculation formula

Then we use the result of the volume calculation in the next formula. We multiply the area by 1.1 to add a 10% contingency then we divide it by the value of a global variable.

Global variables in calculations

We can set global records to use in any formula by going to WooCommerce > Settings > Product Add-Ons. In the Calculation section, there are fields for three variables. Enter values here and they will be available to all your measurement price calculators.

Upsell some more products

Finally, we can use another feature of the Add-Ons Ultimate plugin to encourage the customer to purchase a related product.

We’ll add a ‘Products’ field so that the customer can buy a shovel to help with their aggregate delivery. Even better, we’ll give them a 10% discount. Wa-hoo!

Bonus product

For more information on allowing customers to purchase multiple products from a single product page, take a look at this article.

How to create a WooCommerce product cost calculator for windows and doors

In this example, we’re going to create a customisable window where the user can specify their dimensions, choose some extra options, and the whole price is calculated dynamically.

You can view the demo here.

WooCommerce product price calculator for window

Create the user input fields

As before, let’s create two Number fields so that the user can enter the dimensions of their window.

WooCommerce number fields for price calculator

Note that we’ve set some minimum and maximum parameters to ensure that customers can’t specify windows that are really tiny or absolutely massive.

Create the area and cost calculator formulas

Now we’ll create two calculation fields: one to calculate the area of the window based on the user’s data, and a WooCommerce product price calculator to calculate the cost.

WooCommerce area calculation field

The area calculation formula just multiplies the Width and Height fields, which are entered in millimetres, then divides by 1,000,000 to produce a result in square metres.

We return the result to two decimal places.

Then we add our price calculation:

Product cost calculator

This multiples the result of the area calculation by a factor to obtain our price. Your price calculation might be a bit more complex than this.

Adding calculation fields with conditional logic

Sometimes you’ll want to offer your customers optional extras in your products that will affect the price. We can do this here by creating calculation fields that will only appear if certain conditions are met.

In our window product, we’re going to give the customer the option to select frosted glass. To do this, we create a checkbox called ‘Frosted Glass’.

Then we create a calculation field with another cost calculation that will only display if the checkbox is selected:

WooCommerce conditional calculation field

Now, there’s an additional cost if the user chooses to have frosted glass. If they deselect the option, the cost is removed.

Final thoughts on the WooCommerce measurement price calculator

The calculation field in the Add-Ons Ultimate plugin is incredibly powerful, especially when it’s combined with other features of the plugin. You can:

  • Create calculators that set a dynamic product cost based on user input
  • Include other product options, including upsells
  • Use conditional logic to make calculations only when certain conditions are met
  • Chain calculation fields so that you can use the results from other calculations in new formulas
  • Set the WooCommerce product price by formula

If you need to include a measurement price calculator in your WooCommerce store, you should get the Product Add-Ons Ultimate plugin.

Popular Posts

15 thoughts on “WooCommerce measurement price calculator: calculate price by formula


This is great thanks. I’ve used Product Addons for custom products and its been great. But not as a dynamic calculator yet.

Do you know if along with calculating the price, it will also allow you to set the weight of the product based on those options? Eg lets say you pick 3m x 6m of fabric at 50gm per square meter. We can work out that the weight would be 900g. But how can we tell Woocommerce this so that we can then price the shipping accordingly?


Hi Gareth,
There is an upload module in the Ultimate plugin, is it possible to link it with this price calculator ?
For example, let say I want to sell little books my clients want for a presentation/documentation/paper-news/guide, I tell theme to load a pdf or something, but I want to price it based on the number of pages.
Is it possible ? If yes how do I do ?


Hi – you can calculate the price based on the number of uploaded files, but not the number of pages within a PDF.




Hello. This feature is what I need. Can we talk about a spesific form I want to build.


Hi Erhan – yes, just drop me an email.




Hi Gareth,

Will this plug-in work for carpet? So you would have a select drop down box of 4 meters and 5 meters for the width and then a text box to enter the length.

So the formula.would be… cost per square meter * width * length

The same as the link below:




Hi Iain

Yes, you can do that with this plugin.




Hi! Could I put pictures representing the add-ons to select? Thanks!


Hello Gareth,
is it possible to get the square root of a value with calculation fields?

Best regards


Not at the moment.




Hi Gareth,
I would like to know if through this plugin I can create a group of products which are conditioned by a formula which is determined by an initial value set by the user.

Choice between 10 different sizes.
the quantities of the products loaded change according to that value through a mathematical formula.

Thanks in advance for your reply.


Hi Davide

As far as I understand from what you’ve said, the plugin will be able to do what you need.




Leave a Reply

Your email address will not be published. Required fields are marked *

WooCommerce measurement price calculator: calculate price by formula Changelog