1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Filter the step value in Number fields
  1. Home
  2. Knowledge Base
  3. Product Page
  4. Filter the step value in Number fields
  1. Home
  2. Knowledge Base
  3. Front End
  4. Filter the step value in Number fields
  1. Home
  2. Knowledge Base
  3. Advanced
  4. Filter the step value in Number fields

Filter the step value in Number fields

By default, Number fields can be increased in increments of 1. If you want to change this value, e.g. to use decimals, add this snippet:

<?php
/**
* Filter the step parameter in Number fields to return decimals
*/
function prefix_number_field_step( $step, $item ) {
return 0.01;
}
add_filter( 'pewc_number_field_step', 'prefix_number_field_step', 10, 2 );

Here’s how to add a snippet to your site.

Was this article helpful?

Related Articles