# WooCommerce calculation look up tables

Often, you might want to calculate your product price based on user measurements. And, in some cases, you need to round up the user measurements to specific values in order to return your price. In this article, we’ll look at creating a WooCommerce calculation field using a look up table or pricing grid.

## WooCommerce calculation look up tables

We can use calculation fields in the Pro version of the WooCommerce Product Add-Ons Ultimate plugin for complex calculations. And there’s a complete guide to WooCommerce measurement price calculators here.

Personalise products with extra fields and custom options

But, in this specific case, we want to use a look up table to return our prices.

Here’s an example.

## Selling made to measure blinds and curtains through WooCommerce

In our example, we’re selling made to measure blinds. The customer enters the width and the height (or drop) required. Then our product calculates the price.

However, we don’t want to use the exact measurements provided by the customer to calculate the price. Instead, we want to round each value up to one of our predefined values then get our price from a pricing table.

The screenshot below of a spreadsheet should help to explain. Across the horizontal x axis on the top row you can see values in centimetres, i.e. 80, 100, 120 etc. These are our values for the width of the blind.

And down the first column, the vertical y axis, you can see values in centimetres again. These are our values for the blind’s height.

We can use this grid to return a price based on user measurements. So if the user enters 139cm width by 178cm height, we round up both measurements to the nearest value in the table, which will be 140cm for the width and 180cm for the height.

Then we look across to the 140 column and down to the 180 row to find the price. In this case, the price will be \$414.

You can take a look at this in action in the demo product.

## Creating the look up table

Read prices and values from lookup tables

This extension requires the Pro version of Add-Ons Ultimate.

The Advanced Calculations extension allows you to upload your look up tables as CSV files. You’ll need to format the files in a specific way:

• Give each table a unique name in the top left cell. Table names should be alphanumeric – they can’t just contain numbers. Note that you can upload multiple tables in just one file using this method.
• Enter your X-axis values along the first row
• Enter your Y-axis values in the first column of each subsequent row
• If you have multiple tables, just add the next table as a subsequent row – the plugin will work out that this is a new table. Don’t leave any empty rows

Here’s an example of what a CSV will look like:

You can see that this file contains two tables – ‘TABLE 1’ and ‘TABLE 2’. These are different look up tables that can be used by different calculation fields. You can have as many look up tables as you like in the CSV file.

## Creating add-on fields for a pricing grid calculation field

With your CSV file uploaded, you can now assign tables to different calculation fields.

We need to create two number fields for our width and height measurements. You can take a look at the support document or in the main calculation field article for how to do this.

Now we need to create a calculation field that will use the measurements. To add the calculation field:

• Choose ‘Calculation’ in the ‘Field Type’
• In the ‘Formula’ field enter `{look_up_table}` – make sure you include the curly brackets
• In the ‘Action’ field, choose ‘Display As Cost’. This will ensure that the result of the calculation will be formatted with the correct currency and add to the product price

Then:

• In ‘Field ID for X’ enter the field ID for the values along your x axis
• In ‘Field ID for Y’ enter the field ID for the values along your y axis
• In ‘Look Up Table’, select the name of your table from your CSV file

You can now publish your product.

## WooCommerce calculation look up tables – recap

The Pro version of the Product Add-Ons Ultimate plugin and the Advanced Calculations extension make it easy to use look up tables to determine prices based on user inputs and measurements.

Personalise products with extra fields and custom options

Read prices and values from lookup tables

1. Hi,
Regarding look up tables, is it possible to add or subtract a percentage from them should you want to adjust the price in the front end?

• Yes, you could have a calculation field that used the result of the look up table field.

Thanks.

Gareth

2. Should I be building this as a variable product or a simple product if I’m including attributes such as color.

Thanks,

• If you need to use attributes, then it’s probably best to use a variable product.

3. Hi,

In one product i have couple look up tables with different price, depends of chosen material (three price groups of materials) and dimensions.
How can i define which table it will use by clicking material?

Example
Client chose material group 1, insert dimensions and price should be importet form look up table 1
Client chose material group 2, insert dimensions and price should be importet form look up table 2
Etc

• Hi Dawid

If you look at the second snippet referred to in the article above, you can see that you can define different look up tables for different fields. So you can just used conditional fields, https://pluginrepublic.com/documentation/conditions/, to display different fields depending on which group the client chooses.

Gareth

4. Hi Gareth,
Would it be possible to modify the plugin to use CSV files to upload the prices to save creating Arrays?
I know Magento use this option.

Nigel.

• Hi Nigel

Yes, this is very much on my list of things to do. I haven’t got there yet.

Thanks

Gareth

5. That’s good news. If I committed to this plugin now, would the new feature be available as an upgrade?

• A CSV import is likely to be released as an extension to the plugin. But I don’t have a date scheduled for this yet.

6. i have used select field with option but i doesn’t work

7. Hi,

I have determined min and max value for height and width, but after puting number over the range this is just took it.

How can i make comunicate as in your demo here? to Show information ” value can’t be less than … ”

Thanks

8. Can this plugin support converting a .csv to a website table? We have a very large csv file with different rows and columns and we might find that doing it manually will within the function like you have shown above would take too long. If you can advise that would be most appreciated 🙂

• Hi Marcus

Importing a CSV to the look up table is very much on my list of features to add. I don’t have a date for it yet.

Thanks.

9. is there a video training that shows us how to use this plugin?

• Hi – I don’t have a video for this unfortunately.

Please let me know if you have any questions.

Thanks.

10. Hi Gareth,
I have installed the pro version. I had to convert from cm to mm to get an accurate measurement from the customer size input, so all good. Can you give me an heads up for installing tooltiped dashicons as in your demo site. I can insert one next to width/drop but at the front end it has added text: “data-field-value=””> before the dashicon. I appreciate this is off topic, but would appreciate your thoughts and also the plugin for the tooltip you used, or even if it is at all possible without going into the php files. Great work!

11. Hi, My company sells gifts online, and we have about 10.000 products without the color variations. What I would like to do is:
Create a product with color variations, then add print costs that are gathered from tables with let´s say “2 dimensions”. Meaning. I got the t-shirt, the the user selects the number of color he wishes to print that looks up a table of colors vs quantities (or instance silkscreen). Your Product sounds perfect.

The only question I have is: After I create all my tables manually (ex: pad printing, silkscreen…) can I use the all import plugin (https://www.wpallimport.com/documentation/woocommerce/variable-products/) to assign each table to a product, or, each product must have it’s own table, created manually?

Since wp all import imports custom fields, this would be a game changer for everyone with a large store 🙂

Great tutorial and work, anyway!

• Hi Maria

The best way to do this is to create your calculation fields globally (https://pluginrepublic.com/documentation/global-add-ons/) and apply them to as many products as you like.

Then, we have an extension coming out very shortly that will allow you to import your pricing tables via CSV. You’ll be able to assign your tables to your global fields quickly and easily. The new extension is called Advanced Calculations for Add-Ons Ultimate and it will be available from early next week.

Thanks

Gareth

• I’m eager to see that 🙂 My countdown is ticking 🙂

Do you have some sort of demo trial? Time based, of course?

12. Hi!

how did You set up on this “Window Blinds demo page” Price form 118 if you have to set price 0 because this blinds calculation is set as a cost ? Did YOu Put some Extra Field Or What ?

You could make better tutorial how to do that or make a YouTube movie.

regards

13. Is it possible to set a ratio, and the change 1 field, height or width, for certain things that require to maintain an aspect ratio?

Thanks.

• Hi

I’m not 100% clear on the question. The look up table allows you to return a value based on one or two user inputs. What is it you are looking to do?

Thanks.

14. Hi Gareth! There is a way to reuse lookup table value? I want to add extra 30% to lookup table price in one option, and another option I want to add extra XX price (no percentages). How to do that?

• Hi

Yes, you can use a calculation field to get a value from the look up table; then you can use the value of that calculation field in another calculation field.

Thanks.

15. Hi there, I have a few questions including questions specific to an Excel document, please can I send this over to you.

Kind regards

Jamie

16. Hi Gareth
Can I use this plugin to do a size calculation without using a look-up table?
So customer inputs width* height, plug-in calculates area and provides a price based on the area formula such as £100 per square metre?

Thanks
Kim

• Hi Kim

You can create an area calculation using the customer inputs for width and length. Then you can also calculate the product price based on the area and your own formula.

Thanks.

17. Hi there, I have 200+ products could I make this v lookup table as globally, so I don’t have to recreate table for each product and when price changes then I have to change only in table that all.

Kind regards

Dex

• Hi Dex

Yes, you’d upload the table to one place and you can create a global field that uses the table on multiple products.

Thanks.

• Thanks for the very fast reply,
I want this feature for a single website, can I get this feature in a basic plan?

• To use look up tables on just one website, you’ll need the Pro version of Add-Ons Ultimate and the Basic version of Advanced Calculations.

Thanks.

18. When I enter the length into the table and then add it to the shopping cart. It adds an additional amount to the basket ?

• Hi

Yes, you can use it in this way if you wish.

Thanks.

19. Hey dear Developer,
is the plugin still up to date and compatible with all actual versions (wordpress 6, woocommerce, etc)?
Thx, regards,

• Hey, just saw the changelog, seems this plugin is what i need. nice.

• Hi Moritz

Yes – the plugins are all compatible with the latest versions of WordPress and WooCommerce.

Thanks.

20. Is it possible to use additional calculations right in the formula field where you’d initiate the {look_up_table} price search?
For example do: ({look_up_table} * 0.9) directly in the formula field to get a 10% discount, instead of having to create an extra calculation field with: ({field_xxx_field_price} * 0.9)

• Hi Robert

You can use {look_up_table} in one field to get a value from your look up table. Then use the value returned in another calculation – so then you can do more complex stuff.

If you need further help, please raise a ticket at https://pluginrepublic.com/support/ and the support team will get back to you.

Thanks.

21. Hei,
Is it possible to look up a value on the X-axis based on a field input, but, for the Y-axis, instead of looking up a field, specify a fixed value?

22. Hi,

I am trying to do two table lookups in one product. Only the first table works. The second table doesn’t seem to load up. Any thoughts?

• Hi

Could you raise a support ticket here – https://pluginrepublic.com/support/ – and our team will get on to it for you?

Please provide a link to the page in question, the exact steps to replicate the issue, and a description of the expected behaviour.

Thanks.

23. Can we have more than 3 fixed variables for Calculations?