Think of Uni CPO WooCommerce Product Options and Price Calculation Formulas plugin as a complex system of possibilities for your product configuration, rather than one or several separated tools in a single package. Thus this system has its bindings or features which are the result of coincidence rather than intention. Still, the following Uni CPO features – I prefer to call them *features *because of their importance – are so cool that they had better be invented if never existed.

I think this is the trick number 1 just because of the fact of widespread use of it during the product configuration. The order in which NOVs are saved matters. To put it simply, it means that you can use NOVs from top of the list in formulas/matrix for NOVs which are in the bottom of the list. The mentioned above is illustrated in the following screenshot:

NOV ‘*{uni_nov_cpo_width_m}*‘ is created first. And I am using it in the third NOV called ‘*{uni_nov_cpo_width_m_q}*‘. The reason why is it possible is that NOVs are getting evaluated one by one from top to bottom. So, at the moment of evaluation of variable ‘*{uni_nov_cpo_width_m_q}*‘ the script has already evaluated variable ‘*{uni_nov_cpo_width_m}*‘, it computed its value and can use it to compute the value of the third variable.

Yes, it is tricky because as you may already know that NOV matrices are meant to work with numeric values ONLY. At the same time Suboptions’ slugs, which are the unique names they can be identified with, can be text only.

So, how to combine them? The answer is the third type of setting which is available for all the suboptions. It is called ‘price/rate’, and this is what we need. The rule is – keep them unique across suboptions of a specific option. Just like slugs, but numeric. It can be a simple sequence like “1,2,3,4…” or somewhat meaningful series like on the screenshot below:

In the example, my suboptions are “3 mm”, “5 mm” and “10 mm”, so I used “3”, “5” and “10” values. They are unique for my suboptions, and they are not getting repeated. It is crucial! Then I have chosen this my option as 2nd var in the NOV matrix and used the same values. Note that it could be set as the 1st var and those values would be in the head of the matrix columns. It is not relevant where do you put them and is totally up to you!

The reason why it works is that all options’ choices are getting transformed into numeric values to use them in the price calculation formula. In the case of Select/Radio Option, such numeric values can be set in ‘price/rate’ setting. But it does not mean that they will be used anywhere automatically. They will be used only if you decide to use them and where you decide to use them. So, first, do not fear to use these settings in general. Second, try them in different combinations with other instruments such as NOVs or Formula Conditional Rules.

Sometimes you meet completely non-trivial product configuration and wonder if (and how if possible?) it can be achieved by using Uni CPO. Well, let me give you an example. Hm-m… let’s say you want to add to the product price some fixed value but a certain number of times which depends on some other option/parameter. To be more precise, let’s pretend we need to add feet to our product “Stand” according to the following rules:

- Two pieces initially
- One extra if the width is more than 3 meters
- One additional every 2 meters

Width is a custom option.

First, let’s quickly evaluate what we have got, try to express it mathematically:

- width < 3 = add 2
- width > 3 and width < 5 = add 3 (2+1, I write total here)
- width > 5 and width < 7 = add 4
- width > 7 and width < 9 = add 5
- …

We have got a sequence! ðŸ™‚ It can be described with the following formula: ’round({width}/2)+1′. You can see that I have used one of the maths functions. The full list of available ones can be found in the documentation. How do I get this formula? By trials and errors and deduction. I have just kept looking and trying different ways until I have found the regularity. It might not be perfectly precise or whatever. At least, only you decide if it is good enough. This is exactly what I have done by testing the formula in a spreadsheet against all possible yet significant values of width. I think what is more important is that I can do this with Uni CPO. I do not have to write any additional single line of code. You can achieve the same as well. You do not need to hire a freelancer to do the job. The tool exists already, and it is called Uni CPO WooCommerce Product Options and Price Calculation Formulas plugin ðŸ™‚

You do not need to hire a freelancer to do the job. The tool exists already and it is called Uni CPO WooCommerce Product Options and Price Calculation Formulas plugin

I have used two NOVs:

The first NOV calculates the number of pieces which should be added based on width parameter (to remind: a width is a custom option; customer sets its value). The second NOV is for a price of 1 piece of feet. It might not be needed to keep two NOVs. My final part of the product price formula is this ‘*…+{uni_nov_cpo_feet_qty}*{uni_nov_cpo_feet_price}*‘, but I could keep it like this ‘*…+{uni_nov_cpo_feet_qty}*24}*‘. The real reason why I use the second NOV is to achieve wholesale pricing functionality. It is not shown on the screenshot, but yes – wholesale functionality is also possible with Uni CPO plugin!

Â© 2022 MooMoo Web Studio. All rights reserved. -
Privacy Policy