NB: The calculation field is only available if the Extra-price add-on is also installed and active.
Available functions
The calculation is run using the MEXP library. You can see the list of available functions here: https://github.com/bugwheels94/math-expression-evaluator
There are several other available functions, specific to the configurator:
equals(val1, val2)
returns 1 if val1 is equal to val2, 0 if it is not.
greater_than(val1, val2)
returns 1 if val1 is greater than val2, 0 if it is not.
smaller_than(val1, val2)
returns 1 if val1 is smaller than val2, 0 if it is not.
greatest(val1, val2)
returns the greatest value of the two.
If you require other special functions, you can add them using the filter mkl_pc/math-expression-evaluator/tokens
and following the Mexp token documentation.
E.g.
add_filter( 'mkl_pc/math-expression-evaluator/tokens', function( $tokens ) { $tokens .= ' mexp.addToken([ { type: 8, token: "equals", show: "equals", value: function (a, b) { if(a===b) return 1; return 0; }, } ]); '; return $tokens; } );