Formula Conditional Logic

It is the main feature and the purpose of this plugin - a possibility to use custom maths formula to calculate the product price dynamically based on the values of custom options.

The related modal form can be accessed by clicking on this icon in the Builder.

This is how it looks like:

  • Enable/disable formula conditional logic functionality

There is a big textarea for the main formula - a primary maths formula that will be used if no formula conditional rules are added or any of the rules are passed. You can use any maths formula here, like this:

25*1.07+22

Or with variables like this:

{uni_nov_cpo_width}*{uni_cpo_height}*0.05

Or a single value like this:

22.3

PRO TIP: You can use a special word disable to disable the product price calculation therefore disable product ordering. You can use this word in main formula field or in any formula logic rule's formula field in order to disable the product price calculation for the specific case. Usage case: you may want to disable ordering of the product if width and/or height are set too big. Use it with a conjunction of 'Text to display when ordering is disabled' setting that can be found in product's general settings modal window.

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 the main maths formula as well as in formulas for any formula conditional rule.

Formula Conditional Rules

Formula conditional rules functionality is an extremely powerful tool for creating even more customized price calculation. You can add as many rules as you want (of course, there some limit exists, but it is related to your hosting configuration rather than to any specific limitations created for this tool). Each rule has two parts: a rule condition and a maths formula that can be used if its condition is met.

{uni_nov_cpo_area}

The first rule will be passed if the NOV is less or equal to 24. The second rule will be passed if the NOV is greater or equal to 25 AND less than 51. The third rule will be passed if the NOV is greater or equal to 51.

Design your rules wisely, make them logically correct!

The first important thing about the formula conditional logic is that all the rules are evaluated one by one from the top to the bottom. The second important thing is that whenever a certain rule has passed (returns TRUE; its condition is met) - the evaluating of the rules stops and the formula of the passed rule is used for the price calculation. It is really really important! In the example above, if I sorted the rules in different order, it would be completely messed up and logically incorrect!

Last updated