Round Cart Total
If you are using this hook for rounding totals:
1 2 3 4 5 |
add_filter( 'woocommerce_calculated_total', 'custom_calculated_total' ); function custom_calculated_total( $total ) { $total = round($total); return ceil($total); } |
Then add this code for right rounding with our prices:
1 2 3 4 5 |
add_action("woocommerce_after_calculate_totals", function ($wcCart) { $wcNoFilterWorker = new \ADP\BaseVersion\Includes\WC\WcNoFilterWorker(); $wcNoFilterWorker->calculateTotals($wcCart, $wcNoFilterWorker::FLAG_ALLOW_TOTALS_HOOKS); }, PHP_INT_MAX, 1); add_filter('wdp_calculate_totals_hook_priority', function($priority){return PHP_INT_MAX - 1;}); |