Created
April 9, 2015 03:45
-
-
Save ChromeOrange/b30ba62eac9edb416b14 to your computer and use it in GitHub Desktop.
Fix PayPal Rounding Issues. Add to theme functions.php file
This file contains hidden or 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
add_filter( 'woocommerce_paypal_args', 'fix_paypal_rounding_errors', 10, 2 ); | |
function fix_paypal_rounding_errors ( $paypal_args = NULL, $order = NULL ) { | |
if( $paypal_args ) { | |
foreach( $paypal_args as $key => $value ) { | |
if( substr( $key, 0, 7 ) == 'amount_' || substr( $key, 0 , 9 ) == 'shipping_' ) { | |
$paypal_args[$key] = number_format( round($value,2), 2, '.', '' ); | |
} | |
} | |
} | |
return $paypal_args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment