1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Advanced Topics for Add-Ons Ultimate
  5. Decimal Values
  6. Allow decimal places in condition values

Allow decimal places in condition values

If you set a condition against a Number field, you can define the step value for the condition value. By default, the condition uses whole numbers. If you want to use decimals, you can use the following snippet:

<?php
/**
* Filter the step value for number fields in conditions
*/
function tester_condition_value_step( $step, $field_id ) {
return 0.01;
}
add_filter( 'pewc_condition_value_step', 'tester_condition_value_step', 10, 2 );

Here’s how to use a snippet.

Was this article helpful?

Related Articles