WooCommerce does not change the summary of the basket?

add_action( 'woocommerce_calculate_totals', 'woocommerce_calculate_total', 10, 1 ); 
 woocommerce_calculate_total function( $cart ) {
 if($cart->subtotal < 300){
 $cart->subtotal += 85;
 $cart->total += 85;
}
}


The code works, but $cart->total always returns 0 and it cannot be changed, so the Subtotal is obtained more Total.
WP - 5.3.2. WC - 3.8.1.
April 3rd 20 at 18:46
1 answer
April 3rd 20 at 18:48
Solution
It was necessary to put the hook on woocommerce_after_calculate_totals instead of what I used.

Find more questions by tags WooCommerce