How can I stop rounding off shipping charge in Woocommerce
/** * Get rounding precision for internal WC calculations. * Will increase the precision of wc_get_price_decimals by 2 decimals, unless WC_ROUNDING_PRECISION is set to a higher number. * * @since 2.6.3 * @return int */function wc_get_rounding_precision() { $precision = wc_get_price_decimals() + 2; if ( absint( WC_ROUNDING_PRECISION ) > $precision ) { $precision = absint( WC_ROUNDING_PRECISION ); } return $precision;}
Please check WC_ROUNDING_PRECISION has been set somewhere else ( maybe in theme )
Here are some constants you can set to alter rounding calculation: https://github.com/woocommerce/woocommerce/blob/master/includes/class-woocommerce.php#L207-L209. They’d be defined earlier in your wp-config file to change I believe.
Can see here, that WC will mostly use whichever is higher: https://github.com/woocommerce/woocommerce/blob/64bcabf0af9a05274d53ec833a4e8c9153509bc4/includes/wc-core-functions.php#L1549-L1553. Either WC_ROUNDING_PRECISION constant, or the number of decimals you have set plus 2.
You should check your theme files.
Navigate to file in your theme which is calling function to display price.
There might be PHP function round()
Documentation: Click here
Example :
In your theme file there might be code like this:
<?php echo round($price); ?>
You should change it to:
<?php echo $price; ?>