Woocommerce Filter customization (rounding vs floor)

I have this filter in Woocommerce source code:

$this->total = max( 0, apply_filters( 'woocommerce_calculated_total', round( $this->cart_contents_total + $this->tax_total + $this->shipping_tax_total + $this->shipping_total + $this->fee_total, $this->dp ), $this ) );

I want to apply this change with my filter but I can’t understand how.

Read More
$this->total = max( 0, apply_filters( 'woocommerce_calculated_total', floor(( $this->cart_contents_total + $this->tax_total + $this->shipping_tax_total + $this->shipping_total + $this->fee_total) * 100)/100, $this ) ); 

Any help will be appreciated. A greeting!

Related posts

Leave a Reply

1 comment

  1. Done!

    function custom_round_function( $total, $cart ) {
    
    $total = floor(($cart->cart_contents_total + $cart->tax_total + $cart->shipping_tax_total + $cart->shipping_total + $cart->fee_total) * 100)/100;
    
    return $total;
    }
    
    add_filter( 'woocommerce_calculated_total', 'custom_round_function', 10, 2 );