Rounding prices

You can round to the nearest .05 for example:

1. Download the free Code Snippets plugin: https://wordpress.org/plugins/code-snippets/
2. Create a Snippet with the following code:

(You can optionally add this to your functions.php if you’re more familiar with that process instead.)

function custom_pwbf_discounted_price( $price, $deal ) {
    if ( $deal->deal_type == 'percentage' ) {
        $price = round( $price / 0.05 ) * 0.05;
    }

    return $price;
}
add_filter( 'pwbf_discounted_price', 'custom_pwbf_discounted_price', 10, 2 );

You can change 0.05 above to round to other values such as 0.5, 0.25, etc.

Skip to content