Non Option Variable (NOV)
🔥 A series of video tutorials of how to use Non Option Variables
Non Options Variables (NOVs) are synthetic variables, created for a sole purpose of calculating a specific maths formula or utilising Matrix functionality.
NOV modal can be accessed by clicking on this icon in the Builder.
And this is how the modal window looks like at the beginning:
There are two major settings:
- Enable/disable NOVs functionality
- Enable/disable wholesale functionality for NOVs
Next you can see the list of available Option's variables (or regular variables or simply variables), their special variables and NOV variables. More Options you add - more Option's variables are in this list. These variables can be used in maths formulas for NOVs.
Next is the repeatable list of NOVs actually. Let's review the next example:
In this example: NOVs functionality is enabled; the list of regular variables contains many vars (why they are colored differently?); one simple NOV is added. As it can be seen the value of this NOV is a pretty simple maths formula with two variables used in it. The name of this NOV is
and this is its value
Asterisk operator here means multiplication. Please, read more about arithmetic operators and mathematical functions which can be used in formulas.
So, the result of evaluation of this formula will be the value calculated by multiplication of the value of the first variable and the second variable. Now, it is possible this newly created NOV in Main Formula or Formula Conditional Logic instead of writing possibly a lot of times the mentioned above maths formula of multiplication. This is the main purpose of NOVs - to make life easier! 😊
🏆 PRO TIP: It is possible to use preceded NOVs in NOVs added after. Example: the NOV mentioned above can be used in maths formulas of all the NOVs created after this one. It means that NOVs are evaluated one by one from the top of the list of NOVs to the bottom.
NOV with wholesale functionality
NOV with Matrix functionality
The 'matrix' functionality is a new and exciting feature of Uni CPO version 4. 🤟 It makes it possible to use table based list of prices based on one or two options. 💪
First, check 'Matrix?' checkbox to reveal the related fields. which are: '1st var', '# in cols' and '2nd var'. '1st var' lets you connect a certain option to the values defined in the first row. '# in cols' - the values of the first row, actually. These values must be separated by '|' sign. '2nd var' lets you connect a certain option to the values defined in the first column. The matrix (table) can be edited inline, so there is not a problem to add a new row or delete it. But the number of columns and their first values are taken from '# in cols' field only. It is also possible to use the same option in both '1st var' and '2nd var' fields if you need to pick the price based on one option only.
If you need to add more or make less columns, change the number of values in '# in cols' field and click on "Generate" button. The matrix will rebuild itself then.
It is possible to prepare the table in CSV and then just import it. ⚠️ CSV file must contain semicolon ";" separated values! ⚠️ Not dot separated, not comma separated, but semicolon ";" separated ONLY! These are examples of such files: Step builder CSV files examples. Sometimes decimal numbers of your CSV file can be comma separated. I suggest you to click on "Generate" button just after the import is made. This action will normalize values (will change all the commas to dots, in particular) in the matrix and there will not be any problems of using them. ⚠️ The second limitation is that you CAN use NUMERIC values ONLY! ⚠️ Numeric values for columns, for rows and for cells. NOV matrices are about using numeric values only!
The most important thing about how the matrix works: the closest value will be picked! This the rule of the matrix.
This rule leads us to understanding two possible tactics/usage cases of this table of prices: simple (suitablefor discrete values) and ranges (only suitable if you have to use ranges of option's values).
It looks like this:It can be seen that I intend to use it with discrete values, so, for instance, nothing can be selected in between of 10 and 20 in any of the options chosen. And this matrix covers all the possible pairs of chosen values.
Matrix with ranges
It looks like this:It can be seen that values in the first row and the first column are written like ranges (1 and 2000, 2001 and 2250 and so on) and price values are repeated four times - just to cover both values in each range pair. This is because I intend to let users choose any values in those ranges. So, for instance, user can pick 1400 and 900. So, instead of write down all such possible variations in the table, I put it like 'from' and 'to' values and according to the rule ("the closest value will be picked") it does not really matter if 1400 is closer to 1 or to 2000. And the same is for 900. Price value will still be 400.25.
NOV with unit conversion functionality
This functionality makes it possible to auto convert values of certain variables from one measurement unit to another one. Like, from 'm' to 'in' etc. This is how it looks like:
What is showcased in the screenshot is that I have created a new NOV called
so it always holds the value in meters after converting the value from regular variable
The usage case here is this. 👉 I have an Option "Width" which is width for my product. Actually, I could add a measurement unit name to the Option name, so it could be "Width (cm)" or "Width (ft)" ( ⚠️ it depends on Dimension Unit setting chosen in WooCommerce settings; you cannot choose randomly this value!) and give visitors a clear message in which unit they should add their values. At the same time my prices are for sq.m. therefore I have to get width in 'm' and then multiply it by my base price for 1 m. That's why I created such NOV that always hold the value converted to 'm'. For instance, 'cm' is default dimension unit (according to WC settings), so the script will treat any values inputted in "Width" option like those are in 'cm' and will convert them to 'm'. The converted value is the value of this my NOV.
I can go even further and add another one Option called 'Measurement Unit'. I can give visitors a possibility to choose a measurement unit dynamically. So, instead of using only and ever the default dimension unit, a visitor can choose which one he wants to add values in. This is what must be done prior using such functionality:
This new Option created must be chosen in Measurement Unit setting in Dimensions Settings. Although it is not necessary to enable Dimension Settings, just pick the correct option in the mentioned above setting from that modal window.
Now the script will know which dimension unit to use as 'from' instead of the default one from WC settings! 👍