1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Allow decimal places in condition values
  1. Home
  2. Knowledge Base
  3. Conditions
  4. 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?

Need More Support?

If you can't find the answer that you're looking for, then please use the link below to raise a support ticket.
Contact Support

Related Articles