Title: Rounding off Fee
Last modified: May 12, 2020

---

# Rounding off Fee

 *  Resolved [nititek](https://wordpress.org/support/users/nititek/)
 * (@nititek)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/rounding-off-fee/)
 * Hi,
    Thanks for the plugin… works really well for me. I need a small info. When
   the user inputs the address, the plugin does calculate the fee well. I just want
   to roundn off the fee to the nearest integer so the user sees a rounded off price.
   Eg when the price calculated is 170.12, I want to display 170. Is there a way
   to do this ? I did try the adding filter method in the functions.php. Am I doing
   something wrong ?
 * add_filter( ‘dbf_calculated_fee’, ‘my_dbf_calculated_fee_callback’, 1, 15 );
 * function my_dbf_calculated_fee_callback( $calculatedFee, $kiloMeters, $divider,
   $price ) {
 * return round($calculatedFee);
    }
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Frounding-off-fee%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Gaylord Focker](https://wordpress.org/support/users/webdata/)
 * (@webdata)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/rounding-off-fee/#post-12820635)
 * Hi,
 * Try:
 *     ```
       function my_dbf_calculated_fee_callback( $calculatedFee, $kiloMeters, $divider, $price ) {
          return round($calculatedFee);
       }
       add_filter( ‘dbf_calculated_fee’, ‘my_dbf_calculated_fee_callback’, 10, 4 );
       ```
   
 * Kim
 *  Thread Starter [nititek](https://wordpress.org/support/users/nititek/)
 * (@nititek)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/rounding-off-fee/#post-12842550)
 * Hi Kim, Thanks for your response. Still doesnt work and it shows decimals… I 
   used exactly your code.
    I cleared cache, I also used a default theme.
 * Could you help me out pls ?
 * Thanks
 *  Plugin Author [Gaylord Focker](https://wordpress.org/support/users/webdata/)
 * (@webdata)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/rounding-off-fee/#post-12846850)
 * Are you using taxes for the fee? You can either disable taxes for the fee completely,
   or change settings at the WooCommerce to show taxes separately at the checkout.
   Otherwise taxes will be added to on top of the rounded fee. E.g. rounded fee 
   10.00 + tax 2.40 = 12.40.
 * Kim

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Rounding off Fee’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woo-distance-based-fee_aed8c0.svg)
 * [WebData Distance Based Fee for WooCommerce](https://wordpress.org/plugins/woo-distance-based-fee/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-distance-based-fee/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-distance-based-fee/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-distance-based-fee/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-distance-based-fee/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-distance-based-fee/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Gaylord Focker](https://wordpress.org/support/users/webdata/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/rounding-off-fee/#post-12846850)
 * Status: resolved