Rounding to 5 cents (Swiss Rounding)
-
Hello, I would like to purchase your plugin in Pro version.
However, I really need a solution for Switzerland, where we round prices to 0.00 / 0.05 / 0.10, depending what is nearest (5 cent rounding).
I need to be able to round all the discounted prices in all cases (product price, coupon in cart, bulk discount an so on).
I already found examples like this, but cannot get it to work yet:
https://gist.github.com/AshlinRejo/a3da27af63c3794c3689d679eb96f35dCan you help me? Or point me to the hooks / variables that you use.
I usually can just use something like this to round other WooCommerce variables:
/* round cart total to nearest 0.05 cent */ add_filter( 'woocommerce_calculated_total', 'custom_calculated_total' ); function custom_calculated_total( $total ) { $total = round($total / 0.05) * 0.05; return ($total); }
Thank you very much, will definitely buy the plugin if we can get this to work.
- The topic ‘Rounding to 5 cents (Swiss Rounding)’ is closed to new replies.