Round subtotal
-
Hi
I’am rounding the prices, but unfortunately the subtotal is not taken into account.
Here is my function://round prices add_filter( 'woocommerce_get_price_excluding_tax', 'round_price_product', 10, 1 ); add_filter( 'woocommerce_get_price_including_tax', 'round_price_product', 10, 1 ); add_filter( 'woocommerce_tax_round', 'round_price_product', 10, 1); add_filter( 'woocommerce_get_price', 'round_price_product', 10, 1); add_filter( 'woocommerce_calculated_total', 'round_price_product', 10, 1); function round_price_product( $price ){ // round up $rounded = ceil( $price / 0.05 ) * 0.05; return $rounded; }
This rounds pretty much everything, except the subtotal in the cart.
The result is a price of 24.80 and subtotal of 24.79.
I tried:
add_filter( 'woocommerce_calculated_subtotal', 'round_price_product', 10, 1);
but that has no effect.Does someone have a clue how to add a round-filter for the subtotal?
Thanks for your interest.
theo
- The topic ‘Round subtotal’ is closed to new replies.