Last active
August 29, 2015 14:04
-
-
Save ChromeOrange/9c158e66621fa06e2c86 to your computer and use it in GitHub Desktop.
Fix PayPal rounding error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Round Shipping in the event of PayPal errors | |
*/ | |
add_filter( 'woocommerce_package_rates', 'fix_shipping_rounding_errors' , 10, 2 ); | |
/** | |
* | |
*/ | |
function fix_shipping_rounding_errors( $rates, $package ) { | |
foreach ( $rates as $rate ) { | |
$rate->cost = round( $rate->cost, absint( get_option( 'woocommerce_price_num_decimals' ) ) ); | |
} | |
return $rates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment