Windows Calculator v14.2 is available – power of Formula Variables

6 May 2025

Another big release for the Windows Calculator plugin, what is made for selling uPVC windows and doors on your website.

 

Formula Variables Calculation Stack

The biggest change of this new plugin version is changed logic and features of the formula variables calculation. This new approach gives the possibility to create very flexible calculation of the products properties and prices.

The history of the issue

Initially, v14 had a pre-defined and strict workflow of the product price calculation. Even using custom variable formulas that, was only possible to add custom variables into a specific pre-defined step of this process.

For example, that wasn’t possible to affect individual product price with a common option custom variable, because option variables were applied after individual product price calculation.

And if you’d want to add an extra price calculation at the end of the workflow. To do that, that was necessary to add a hidden option to the end of the page. Such approach wasn’t comfortable to create complicated projects.

The solution

The calculation process was completely remade to have a stack of the variables and formulas to be calculated.

  1. Updating all native variables, such as current sizes and cart state;
  2. Adding custom variables and formulas of all active elements into the Main Calculation Stack which is made of:
    1. Adding Calculator custom variables into the Main Calculation Stack;
    2. Adding [combination_price] variable calculation into the Main Calculation Stack which is made of:
      1. Cloning the Main Calculation Stack into the Product-Level Calculation Stack
      2. Getting of the [product_price] variable – using of the simple product price for common pricing type, or finding price from the sizes table for individual pricing type;
      3. Adding Product custom variables into the Product-Level Calculation Stack;
      4. Adding Product Variation custom variables into the Product-Level Calculation Stack;
      5. Adding Individual Product Options custom variables into the Product-Level Calculation Stack;
      6. Calculating the Product-Level Calculation Stack for this product only;
      7. Adding the final [product_price] to the [combination_price] variable;
    3. Adding Combination custom variables into the Main Calculation Stack;
    4. Passing [combination_price] into the [total_price] variable;
    5. Adding Common Options custom variables into the Main Calculation Stack.

Looks complicated at a glance. But there are no so many steps. Let’s see what this approach gave:

1. That gave the possibility to affect individual product price variable with common option value.

To make it more clear, we’ll explore this specific example.

Let’s assume this product variation size 65×100 is found in the size table and have price equal to 100.

Imagine this product have such custom formula to modify the product price variable using an actual product perimeter and a custom color_price_modifier variable.

product_price = [product_price] + ([color_price_modifier] * 2 * ([product_width] + [product_height]))

While as “Color” option values have such custom variables:

  • White: color_price_modifier = 0
  • Wood: color_price_modifier = 1.2
  • Black: color_price_modifier = 1.5

During the calculating combination price, after cloning of the Main Calculation Stack with all common option values added (“Color – Wood” for our example) into the Product-Level Calculation Stack it will look like:

  1. color_price_modifier = 1.2 – got from “Wood” value of “Color” option;
  2. product_price = 100 – found in the sizes table;
  3. product_price = [product_price] + ([color_price_modifier] * 2 * ([product_width] + [product_height])) = 100 + (1.2 * 2 * (65 + 100)) = 496

That way the final product price will be equal to 496 and will be passed into combination price.

2. That gave the possibility to place custom variables and formulas upper and lower any stage of the calculation.

That would be easier to undertand with another example. What if you’d want to modify the product price different ways. For the same “Color” option:

  • White: product_price = [product_price] + (5 * [product_width] * [product_height])
  • Wood: product_price = [product_price] + (7 * (2 * ([product_width] + [product_height])))
  • Black: product_price = [product_price] * 500

For our example, there will be such calculation stack:

  1. product_price = [product_price] + (7 * (2 * ([product_width] + [product_height]))) – will throw and error cause [product_price] variable isn’t defined yet, so will do nothing;
  2. product_price = 100 – found in the sizes table.

That way the product price will be kept the same while calculating the combination price. How to change the order of these formulas to calculate it differently?

For that case is needed to change the new Priority setting of the custom variable formula. Initially, all formulas in the stack have 20 priority. With the setting you can hoist or lower down the formula. A value less than 20 will be calculated earlier, while as value greater than 20 will be calculated later.

For our example only need to change “Color” option values priority to 21 or higher if necessary. That way the calculation stack will look like this:

  1. product_price = 100 – found in the sizes table;
  2. product_price = [product_price] + (7 * (2 * ([product_width] + [product_height]))) = 100 + (7 * (2 * (65 + 100)) = 2410;

Using this feature you can create a very flexible calculation process. It indeed gives the way to create almost ANY calculation workflow for your project.

Combination/Product variation square limit settings

We got a lot of feedback about requirement to limit minimum or maximum possible square for specific products. It’s a usual case, because some glass can become fragile if the square is too large.

New settings allow setting these limits at the combination level for common pricing type, and at the product variation level for individual pricing type. Product or combination with unavailable selected size will have an exclamation with a message above. Also, that will not be possible to buy or add such product to the cart.

WooCommerce global settings

Initially, the plugin did override the default single product template if it had the special “Windows Calculator Combination” type.

From that version, that’s possible to off this behavior if necessary and use any available WooCommerce single product page action to output the calculator on that place. That gives more flexibility for organizing the product page.

Smaller Improvements

There are also smaller but very helpful improvements available with this release. For example, clone cart item button, a combined button to save and load a cart preset into the account, re-ordering option values or product variations, and other.

Also, the plugin code is made more reliable and optimized. And some bugs are fixed too, of course!

We will continue to improve plugin possibilities! Stay tuned 😉

Windows Calculator

Windows Calculator

Plastic Windows & Doors WordPress Plugin
Learn more
RUB USD